Search in sources :

Example 1 with VertxThread

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();
}
Also used : VertxThread(io.vertx.core.impl.VertxThread) VertxThread(io.vertx.core.impl.VertxThread)

Example 2 with VertxThread

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();
}
Also used : VertxThread(io.vertx.core.impl.VertxThread) VertxThreadFactory(io.vertx.core.spi.VertxThreadFactory) TimeUnit(java.util.concurrent.TimeUnit) VertxBuilder(io.vertx.core.impl.VertxBuilder) VertxOptions(io.vertx.core.VertxOptions)

Aggregations

VertxThread (io.vertx.core.impl.VertxThread)2 VertxOptions (io.vertx.core.VertxOptions)1 VertxBuilder (io.vertx.core.impl.VertxBuilder)1 VertxThreadFactory (io.vertx.core.spi.VertxThreadFactory)1 TimeUnit (java.util.concurrent.TimeUnit)1