Search in sources :

Example 1 with VertxThreadFactory

use of io.vertx.core.spi.VertxThreadFactory 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

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