mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Added test for worker starvation when lock concurrency is greater than worker pool size (#3264)
See #3126 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
This commit is contained in:
@@ -11,9 +11,7 @@
|
||||
|
||||
package io.vertx.core.shareddata;
|
||||
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Context;
|
||||
import io.vertx.core.Vertx;
|
||||
import io.vertx.core.*;
|
||||
import io.vertx.test.core.VertxTestBase;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -228,4 +226,21 @@ public class AsynchronousLockTest extends VertxTestBase {
|
||||
await();
|
||||
assertEquals(2, count.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoWorkerStarvation() {
|
||||
waitFor(5);
|
||||
getVertx().deployVerticle(() -> new AbstractVerticle() {
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
vertx.sharedData().getLock("foo", onSuccess(lock -> {
|
||||
vertx.setTimer(10, l -> {
|
||||
lock.release();
|
||||
complete();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}, new DeploymentOptions().setInstances(5).setWorkerPoolName("bar").setWorkerPoolSize(1));
|
||||
await();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user