case "maxWorkerExecuteTime": if (member.getValue() instanceof Number) { obj.setMaxWorkerExecuteTime(((Number)member.getValue()).longValue());
int nioThreads = props.getNioThread() > 0 ? props.getNioThread() : Runtime.getRuntime().availableProcessors(); options.setEventLoopPoolSize(nioThreads); options.setMaxWorkerExecuteTime(1000);
@Test public void testBlockCheckExecuteBlocking() throws Exception { Verticle verticle = new AbstractVerticle() { @Override public void start() throws InterruptedException { vertx.executeBlocking(fut -> { try { Thread.sleep(3000); } catch (InterruptedException e) { fail(); } testComplete(); }, ar -> {}); } }; // set warning threshold to 1s and the exception threshold as well long maxWorkerExecuteTime = 1; TimeUnit maxWorkerExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); newVertx.deployVerticle(verticle); await(); blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit); } }
public static ConsulTestEnv startVertxAndCluster() { ConsulTestEnv env = ConsulTestEnv.create(Vertx.vertx(new VertxOptions().setMaxWorkerExecuteTime(240L * 1000 * 1000000))); //For first run, embedded-consul download binaries, and it can take a significant amount of of time... AtomicBoolean done = new AtomicBoolean(); env.startMany(null, 3, 2, null).setHandler(ar -> done.set(true)); await().atMost(4, TimeUnit.MINUTES).untilAtomic(done, is(true)); return env; }
@Test public void testBlockCheckWorker() 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 maxWorkerExecuteTime = 1; TimeUnit maxWorkerExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); DeploymentOptions deploymentOptions = new DeploymentOptions(); deploymentOptions.setWorker(true); newVertx.deployVerticle(verticle, deploymentOptions); await(); blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit); }
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.setClusterPingReplyInterval(clusterPingReplyInterval); options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); options.setMaxWorkerExecuteTime(maxWorkerExecuteTime); options.setHAEnabled(haEnabled); options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
@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); }
case "maxWorkerExecuteTime": if (member.getValue() instanceof Number) { obj.setMaxWorkerExecuteTime(((Number)member.getValue()).longValue());
@Test public void testBlockCheckExecuteBlocking() throws Exception { Verticle verticle = new AbstractVerticle() { @Override public void start() throws InterruptedException { vertx.executeBlocking(fut -> { try { Thread.sleep(3000); } catch (InterruptedException e) { fail(); } testComplete(); }, ar -> {}); } }; // set warning threshold to 1s and the exception threshold as well long maxWorkerExecuteTime = 1; TimeUnit maxWorkerExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); newVertx.deployVerticle(verticle); await(); blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit); } }
@Test public void testBlockCheckWorker() 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 maxWorkerExecuteTime = 1; TimeUnit maxWorkerExecuteTimeUnit = SECONDS; VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime); vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit); vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime); vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit); Vertx newVertx = vertx(vertxOptions); DeploymentOptions deploymentOptions = new DeploymentOptions(); deploymentOptions.setWorker(true); newVertx.deployVerticle(verticle, deploymentOptions); await(); blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit); }
assertEquals(options, options.setMaxWorkerExecuteTime(rand)); assertEquals(rand, options.getMaxWorkerExecuteTime()); try { options.setMaxWorkerExecuteTime(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {
options.setClusterPingReplyInterval(clusterPingReplyInterval); options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime); options.setMaxWorkerExecuteTime(maxWorkerExecuteTime); options.setHAEnabled(haEnabled); options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
assertEquals(options, options.setMaxWorkerExecuteTime(rand)); assertEquals(rand, options.getMaxWorkerExecuteTime()); try { options.setMaxWorkerExecuteTime(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {