本文整理了Java中io.vertx.core.VertxOptions.setMaxWorkerExecuteTime()
方法的一些代码示例,展示了VertxOptions.setMaxWorkerExecuteTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.setMaxWorkerExecuteTime()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:setMaxWorkerExecuteTime
[英]Sets the value of max worker execute time, in VertxOptions#setMaxWorkerExecuteTimeUnit.
The default value of VertxOptions#setMaxWorkerExecuteTimeUnit is TimeUnit#NANOSECONDS
[中]以VertxOptions#setMaxWorkerExecuteTimeUnit为单位设置最大工作线程执行时间的值。
VertxOptions#setMaxWorkerExecuteTimeUnit的默认值为时间单位#纳秒
代码示例来源:origin: eclipse-vertx/vert.x
case "maxWorkerExecuteTime":
if (member.getValue() instanceof Number) {
obj.setMaxWorkerExecuteTime(((Number)member.getValue()).longValue());
代码示例来源:origin: wanghongfei/gae
int nioThreads = props.getNioThread() > 0 ? props.getNioThread() : Runtime.getRuntime().availableProcessors();
options.setEventLoopPoolSize(nioThreads);
options.setMaxWorkerExecuteTime(1000);
代码示例来源:origin: eclipse-vertx/vert.x
@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);
}
}
代码示例来源:origin: fr.javacrea/vertx-consul-test-env
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;
}
代码示例来源:origin: eclipse-vertx/vert.x
@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);
}
代码示例来源:origin: codingchili/excelastic
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();
}
});
}
代码示例来源:origin: eclipse-vertx/vert.x
options.setClusterPingReplyInterval(clusterPingReplyInterval);
options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
代码示例来源:origin: org.amv.vertx/amv-vertx-spring-boot-starter
@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);
}
代码示例来源:origin: io.vertx/vertx-core
case "maxWorkerExecuteTime":
if (member.getValue() instanceof Number) {
obj.setMaxWorkerExecuteTime(((Number)member.getValue()).longValue());
代码示例来源:origin: io.vertx/vertx-core
@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);
}
}
代码示例来源:origin: io.vertx/vertx-core
@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);
}
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(options, options.setMaxWorkerExecuteTime(rand));
assertEquals(rand, options.getMaxWorkerExecuteTime());
try {
options.setMaxWorkerExecuteTime(0);
fail("Should throw exception");
} catch (IllegalArgumentException e) {
代码示例来源:origin: io.vertx/vertx-core
options.setClusterPingReplyInterval(clusterPingReplyInterval);
options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
代码示例来源:origin: io.vertx/vertx-core
assertEquals(options, options.setMaxWorkerExecuteTime(rand));
assertEquals(rand, options.getMaxWorkerExecuteTime());
try {
options.setMaxWorkerExecuteTime(0);
fail("Should throw exception");
} catch (IllegalArgumentException e) {
内容来源于网络,如有侵权,请联系作者删除!