use of io.vertx.core.Verticle in project vert.x by eclipse.
the class BlockedThreadCheckerTest method testBlockCheckDefault.
@Test
public void testBlockCheckDefault() throws Exception {
Verticle verticle = new AbstractVerticle() {
@Override
public void start() throws InterruptedException {
Thread.sleep(6000);
testComplete();
}
};
vertx.deployVerticle(verticle);
await();
}
use of io.vertx.core.Verticle 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.Verticle 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.Verticle 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.Verticle in project vert.x by eclipse.
the class JavaVerticleFactory method createVerticle.
@Override
public Verticle createVerticle(String verticleName, ClassLoader classLoader) throws Exception {
verticleName = VerticleFactory.removePrefix(verticleName);
Class clazz;
if (verticleName.endsWith(".java")) {
CompilingClassLoader compilingLoader = new CompilingClassLoader(classLoader, verticleName);
String className = compilingLoader.resolveMainClassName();
clazz = compilingLoader.loadClass(className);
} else {
clazz = classLoader.loadClass(verticleName);
}
return (Verticle) clazz.newInstance();
}
Aggregations