use of io.vertx.core.impl.VertxThread in project vert.x by eclipse.
the class NamedWorkerPoolTest method testMaxExecuteTime.
public void testMaxExecuteTime(WorkerExecutor worker, long maxExecuteTime, TimeUnit maxExecuteTimeUnit) {
worker.executeBlocking(f -> {
Thread t = Thread.currentThread();
assertTrue(t instanceof VertxThread);
VertxThread thread = (VertxThread) t;
assertEquals(maxExecuteTime, thread.maxExecTime());
assertEquals(maxExecuteTimeUnit, thread.maxExecTimeUnit());
f.complete();
}, res -> {
testComplete();
});
await();
}
use of io.vertx.core.impl.VertxThread in project java-chassis by ServiceComb.
the class VertxUtils method init.
public static Vertx init(String name, VertxOptions vertxOptions) {
if (vertxOptions == null) {
vertxOptions = new VertxOptions();
}
boolean isDebug = ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("jdwp");
if (isDebug) {
vertxOptions.setBlockedThreadCheckInterval(BLOCKED_THREAD_CHECK_INTERVAL);
LOGGER.info("in debug mode, disable blocked thread check.");
}
configureVertxFileCaching(vertxOptions);
return new VertxBuilder(vertxOptions).threadFactory(new VertxThreadFactory() {
@Override
public VertxThread newVertxThread(Runnable target, String threadName, boolean worker, long maxExecTime, TimeUnit maxExecTimeUnit) {
return VertxThreadFactory.super.newVertxThread(target, name + "-" + threadName, worker, maxExecTime, maxExecTimeUnit);
}
}).init().vertx();
}
Aggregations