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:
Thomas Segismont
2020-01-29 11:09:37 +01:00
committed by GitHub
parent 2add4436dd
commit 86d5b6a718

View File

@@ -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();
}
}