Example usage for io.vertx.core VertxOptions setBlockedThreadCheckInterval

List of usage examples for io.vertx.core VertxOptions setBlockedThreadCheckInterval

Introduction

In this page you can find the example usage for io.vertx.core VertxOptions setBlockedThreadCheckInterval.

Prototype

public VertxOptions setBlockedThreadCheckInterval(long blockedThreadCheckInterval) 

Source Link

Document

Sets the value of blocked thread check period, in VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit .

Usage

From source file:com.dinstone.vertx.starter.config.VertxAutoConfiguration.java

License:Apache License

private VertxOptions loadVertxOptions() {
    VertxOptions vertxOptions = new VertxOptions();
    int blockedCheckInterval = vertxProperties.getBlockedThreadCheckInterval();
    if (blockedCheckInterval > 0) {
        vertxOptions.setBlockedThreadCheckInterval(blockedCheckInterval);
    }/*w  w  w.  j  a  v a 2s. co m*/

    if (vertxProperties.getEventLoopPoolSize() > 0) {
        vertxOptions.setEventLoopPoolSize(vertxProperties.getEventLoopPoolSize());
    }

    if (vertxProperties.getWorkerPoolSize() > 0) {
        vertxOptions.setWorkerPoolSize(vertxProperties.getWorkerPoolSize());
    }

    return vertxOptions;
}

From source file:de.elsibay.EbbTicketShowcase.java

License:Open Source License

public static void main(String[] args) {
    VertxOptions vo = new VertxOptions();
    vo.setBlockedThreadCheckInterval(1000 * 60 * 2);
    Vertx vertx = Vertx.vertx(vo);/*from  ww w  .j  a  v a2  s.  com*/
    vertx.deployVerticle(EbbTicketShowcase.class.getName());
}

From source file:io.servicecomb.foundation.vertx.VertxUtils.java

License:Apache License

public static Vertx init(String name, VertxOptions vertxOptions) {
    if (vertxOptions == null) {
        vertxOptions = new VertxOptions();
    }//from w w w. ja  v  a2  s. c om

    boolean isDebug = ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("jdwp") >= 0;
    if (isDebug) {
        vertxOptions.setBlockedThreadCheckInterval(BLOCKED_THREAD_CHECK_INTERVAL);
        LOGGER.info("in debug mode, disable blocked thread check.");
    }

    configureVertxFileCaching();
    return new VertxImplEx(name, vertxOptions);
}

From source file:org.apache.servicecomb.foundation.vertx.VertxUtils.java

License:Apache License

public static Vertx init(String name, VertxOptions vertxOptions) {
    if (vertxOptions == null) {
        vertxOptions = new VertxOptions();
    }/*from  w  w w. j  a  v  a2 s .co m*/

    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();
    return new VertxImplEx(name, vertxOptions);
}

From source file:org.lealone.client.ClientSession.java

License:Mozilla Public License

public ClientSession(ConnectionInfo ci) {
    this.ci = ci;
    if (vertx == null) {
        synchronized (ClientSession.class) {
            if (vertx == null) {
                VertxOptions opt = new VertxOptions();
                opt.setBlockedThreadCheckInterval(Integer.MAX_VALUE);
                vertx = Vertx.vertx(opt);
                NetClientOptions options = new NetClientOptions().setConnectTimeout(10000);
                client = vertx.createNetClient(options);
            }//  w ww  .j  a v a  2  s. c om
        }
    }
}

From source file:org.lealone.server.TcpServer.java

License:Open Source License

@Override
public synchronized void run() {
    synchronized (TcpServer.class) {
        if (vertx == null) {
            VertxOptions opt = new VertxOptions();
            if (blockedThreadCheckInterval != null) {
                if (blockedThreadCheckInterval <= 0)
                    blockedThreadCheckInterval = Integer.MAX_VALUE;

                opt.setBlockedThreadCheckInterval(blockedThreadCheckInterval);
            }/*from  ww  w . ja  v  a  2s . c o  m*/
            vertx = Vertx.vertx(opt);
        }
    }
    server = vertx.createNetServer();
    server.connectHandler(socket -> {
        if (TcpServer.this.allow(socket)) {
            AsyncConnection ac = new AsyncConnection(socket, true);
            ac.setBaseDir(TcpServer.this.baseDir);
            ac.setIfExists(TcpServer.this.ifExists);
            CommandHandler.addConnection(ac);
            socket.handler(ac);
            socket.closeHandler(v -> {
                CommandHandler.removeConnection(ac);
            });
        } else {
            // TODO
            // should support a list of allowed databases
            // and a list of allowed clients
            socket.close();
            throw DbException.get(ErrorCode.REMOTE_CONNECTION_NOT_ALLOWED);
        }
    });

    CountDownLatch latch = new CountDownLatch(1);
    server.listen(port, host, res -> {
        if (res.succeeded()) {
            latch.countDown();
        } else {
            throw DbException.convert(res.cause());
        }
    });

    CommandHandler.startCommandHandlers();
    try {
        latch.await();
    } catch (InterruptedException e) {
        throw DbException.convert(e);
    }
}

From source file:se.liquidbytes.jel.JelStarter.java

License:Apache License

/**
 * Startup application verticles/* ww w .  j  a  v  a2  s .  c  o  m*/
 */
private static void startServer() {

    logger.info("Starting JEL-server..." + (Settings.isDebug() ? " AND RUNNING IN DEBUG-MODE!" : ""));

    VertxOptions options = new VertxOptions();
    if (Settings.isDebug()) {
        options.setBlockedThreadCheckInterval(1000 * 60 * 60); // Disable errors about event-loop being blocked when stuck on breakpoints. This will clutter the console otherwise.
    }

    vertx = Vertx.vertx(options);

    Future<Void> future = Future.future();
    future.setHandler(res -> {
        if (res.failed()) {
            shutdownServer(); // If any of the vertices failed to deploy, shut down the application.
        } else {
            logger.debug("Done deploying main verticles.");
        }
    });

    // Start up verticles in turn. If one fails ignore the rest.
    deployDatabaseVerticle(future, (Future<Void> event1) -> {
        deployMainJelVerticle(future, (Future<Void> event2) -> {
            deployWebserverVerticle(future, null);
        });
    });
}

From source file:suonos.app.AppMain.java

License:Apache License

private void main_(String[] args) throws IOException {
    // Init container.
    ////  w ww  .j  a v a 2  s  . co m
    AntLib.setAntLibProvider(new DefaultAntLibProvider());
    container = new SuonosContainer();

    // container.shareBean(new MockPlayer());

    // Wire in VERTX
    //
    VertxOptions options = new VertxOptions();
    options.setBlockedThreadCheckInterval(1000000000);
    Vertx vertx = Vertx.vertx(options);
    container.shareBean(vertx);

    // Wire in MPlayer.
    //
    container.shareBean(new MPlayerBuilder());

    // Setup default fields.
    //
    LuceneIndex index = container.getBean(LuceneIndex.class);

    // Setup context and run.
    //
    try (Closeable it = SuonosLib.enterCtx()) {
        container.init();
        while (true) {
            run(args);
        }
    }
}