use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class BlockedThreadCheckerTest method testBlockCheckWorker.
@Test
public void testBlockCheckWorker() throws Exception {
Verticle verticle = new AbstractVerticle() {
@Override
public void start() throws InterruptedException {
Thread.sleep(2000);
testComplete();
}
};
// set warning threshold to 1s and the exception threshold as well
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setMaxWorkerExecuteTime(1000000000);
vertxOptions.setWarningExceptionTime(1000000000);
Vertx newVertx = vertx(vertxOptions);
DeploymentOptions deploymentOptions = new DeploymentOptions();
deploymentOptions.setWorker(true);
newVertx.deployVerticle(verticle, deploymentOptions);
await();
}
use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class BlockedThreadCheckerTest method testBlockCheckExecuteBlocking.
@Test
public void testBlockCheckExecuteBlocking() throws Exception {
Verticle verticle = new AbstractVerticle() {
@Override
public void start() throws InterruptedException {
vertx.executeBlocking(fut -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
fail();
}
testComplete();
}, ar -> {
});
}
};
// set warning threshold to 1s and the exception threshold as well
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setMaxWorkerExecuteTime(1000000000);
vertxOptions.setWarningExceptionTime(1000000000);
Vertx newVertx = vertx(vertxOptions);
newVertx.deployVerticle(verticle);
await();
}
use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class BlockedThreadCheckerTest method testBlockCheckExceptionTimeLimit.
@Test
public void testBlockCheckExceptionTimeLimit() throws Exception {
Verticle verticle = new AbstractVerticle() {
@Override
public void start() throws InterruptedException {
Thread.sleep(2000);
testComplete();
}
};
// set warning threshold to 1s and the exception threshold as well
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setMaxEventLoopExecuteTime(1000000000);
vertxOptions.setWarningExceptionTime(1000000000);
Vertx newVertx = vertx(vertxOptions);
newVertx.deployVerticle(verticle);
await();
}
use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class MetricsOptionsTest method testMetricsFromServiceLoader.
@Test
public void testMetricsFromServiceLoader() {
vertx.close();
VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true));
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
assertNotNull(metrics);
assertTrue(metrics instanceof FakeVertxMetrics);
}
use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class MetricsOptionsTest method testSetMetricsInstanceTakesPrecedenceOverServiceLoader.
@Test
public void testSetMetricsInstanceTakesPrecedenceOverServiceLoader() {
DummyVertxMetrics metrics = DummyVertxMetrics.INSTANCE;
vertx.close();
VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new SimpleVertxMetricsFactory<>(metrics)));
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
}
Aggregations