case "maxEventLoopExecuteTime": if (member.getValue() instanceof Number) { obj.setMaxEventLoopExecuteTime(((Number)member.getValue()).longValue());
VertxOptions options = new VertxOptions(); options.setMaxEventLoopExecuteTime(Long.MAX_VALUE); vertx = Vertx.vertx(options);`
@Test public void testBlockCheckExceptionTimeLimit() throws Exception { Verticle verticle = new AbstractVerticle() { @Override public void start() throws InterruptedException { Thread.sleep(3000); testComplete(); } }; // set warning threshold to 1s and the exception threshold as well long maxEventLoopExecuteTime = 1; TimeUnit maxEventLoopExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); vertxOptions.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxEventLoopExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxEventLoopExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); newVertx.deployVerticle(verticle); await(); blockedThreadWarning.expectMessage("vert.x-eventloop-thread", maxEventLoopExecuteTime, maxEventLoopExecuteTimeUnit); }
private ApplicationLauncher(String[] args) { VertxOptions options = new VertxOptions(); options.setMaxWorkerExecuteTime(options.getMaxWorkerExecuteTime() * 20) // 20 minutes. .setMaxEventLoopExecuteTime(options.getMaxEventLoopExecuteTime() * 10) // 10 seconds. .setBlockedThreadCheckInterval(8000); vertx = Vertx.vertx(); ImportEventCodec.registerOn(vertx); logger.startupMessage(); start().setHandler(done -> { if (done.succeeded()) { logger.applicationStartup(); if (args.length > 1) { // import file from the command line. new CommandLine(vertx, args); } else { // wait for the elasticsearch server to come online to show the import UI. waitForElasticServerAvailability(); } } else { logger.applicationStartupFailure(done.cause()); vertx.close(); } }); }
options.setClusterPingInterval(clusterPingInterval); options.setClusterPingReplyInterval(clusterPingReplyInterval); options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); options.setMaxWorkerExecuteTime(maxWorkerExecuteTime); options.setHAEnabled(haEnabled);
/** * Configures the Vert.x options based on this object's property values. * * @param options The options to configure. * @return The (updated) options. */ public VertxOptions configureVertx(final VertxOptions options) { options.setPreferNativeTransport(this.preferNative); if (this.enableMetrics) { options.setMetricsOptions(new MetricsOptions().setEnabled(true)); } options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTimeMillis * 1000000L); options.setWarningExceptionTime(maxEventLoopExecuteTimeMillis * 1500000L); options.setAddressResolverOptions(new AddressResolverOptions() .setCacheNegativeTimeToLive(0) // discard failed DNS lookup results immediately .setCacheMaxTimeToLive(0) // support DNS based service resolution .setQueryTimeout(dnsQueryTimeout)); return options; }
case "maxEventLoopExecuteTime": if (member.getValue() instanceof Number) { obj.setMaxEventLoopExecuteTime(((Number)member.getValue()).longValue());
@ConditionalOnMissingBean(VertxOptions.class) @Bean public VertxOptions vertxOptions(EventBusOptions eventBusOptions, MetricsOptions metricsOptions) { return new VertxOptions() .setBlockedThreadCheckInterval(properties.getBlockedThreadCheckInterval()) .setEventLoopPoolSize(properties.getEventLoopPoolSize()) .setWorkerPoolSize(properties.getWorkerPoolSize()) .setInternalBlockingPoolSize(properties.getInternalBlockingPoolSize()) .setQuorumSize(properties.getQuorumSize()) .setMaxEventLoopExecuteTime(properties.getMaxEventLoopExecuteTime()) .setHAGroup(properties.getHaGroup()) .setMaxWorkerExecuteTime(properties.getMaxWorkerExecuteTime()) .setWarningExceptionTime(properties.getWarningExceptionTime()) .setFileResolverCachingEnabled(properties.isFileResolverCachingEnabled()) .setHAEnabled(properties.isHaEnabled()) .setEventBusOptions(eventBusOptions) .setMetricsOptions(metricsOptions); }
@Test public void testBlockCheckExceptionTimeLimit() throws Exception { Verticle verticle = new AbstractVerticle() { @Override public void start() throws InterruptedException { Thread.sleep(3000); testComplete(); } }; // set warning threshold to 1s and the exception threshold as well long maxEventLoopExecuteTime = 1; TimeUnit maxEventLoopExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); vertxOptions.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxEventLoopExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxEventLoopExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); newVertx.deployVerticle(verticle); await(); blockedThreadWarning.expectMessage("vert.x-eventloop-thread", maxEventLoopExecuteTime, maxEventLoopExecuteTimeUnit); }
assertEquals(options, options.setMaxEventLoopExecuteTime(rand)); assertEquals(rand, options.getMaxEventLoopExecuteTime()); try { options.setMaxEventLoopExecuteTime(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {
options.setClusterPingInterval(clusterPingInterval); options.setClusterPingReplyInterval(clusterPingReplyInterval); options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); options.setMaxWorkerExecuteTime(maxWorkerExecuteTime); options.setHAEnabled(haEnabled);
assertEquals(options, options.setMaxEventLoopExecuteTime(rand)); assertEquals(rand, options.getMaxEventLoopExecuteTime()); try { options.setMaxEventLoopExecuteTime(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {