Search in sources :

Example 6 with VertxBuilder

use of io.vertx.core.impl.VertxBuilder 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

VertxBuilder (io.vertx.core.impl.VertxBuilder)6 Vertx (io.vertx.core.Vertx)4 VertxOptions (io.vertx.core.VertxOptions)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Promise (io.vertx.core.Promise)2 JsonObject (io.vertx.core.json.JsonObject)2 NodeSelector (io.vertx.core.spi.cluster.NodeSelector)2 VertxTestBase (io.vertx.test.core.VertxTestBase)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Test (org.junit.Test)2 EventLoopGroup (io.netty.channel.EventLoopGroup)1 AsyncResult (io.vertx.core.AsyncResult)1 CompositeFuture (io.vertx.core.CompositeFuture)1 EventBusOptions (io.vertx.core.eventbus.EventBusOptions)1 VertxThread (io.vertx.core.impl.VertxThread)1 Transport (io.vertx.core.net.impl.transport.Transport)1 VertxThreadFactory (io.vertx.core.spi.VertxThreadFactory)1 ClusterManager (io.vertx.core.spi.cluster.ClusterManager)1 NodeInfo (io.vertx.core.spi.cluster.NodeInfo)1 RegistrationUpdateEvent (io.vertx.core.spi.cluster.RegistrationUpdateEvent)1