本文整理了Java中io.vertx.core.VertxOptions.getMaxWorkerExecuteTime()
方法的一些代码示例,展示了VertxOptions.getMaxWorkerExecuteTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.getMaxWorkerExecuteTime()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:getMaxWorkerExecuteTime
[英]Get the value of max worker execute time, in VertxOptions#setMaxWorkerExecuteTimeUnit.
Vert.x will automatically log a warning if it detects that worker threads haven't returned within this time.
This can be used to detect where the user is blocking a worker thread for too long. Although worker threads can be blocked longer than event loop threads, they shouldn't be blocked for long periods of time.
The default value of VertxOptions#setMaxWorkerExecuteTimeUnit is TimeUnit#NANOSECONDS
[中]获取最大工作者执行时间的值,单位为VertxOptions#setMaxWorkerExecuteTimeUnit。
维特。如果x检测到工作线程在此时间内没有返回,它将自动记录警告。
这可用于检测用户在何处阻塞工作线程的时间过长。虽然工作线程的阻塞时间可能比事件循环线程长,但它们不应该被阻塞很长时间。
VertxOptions#setMaxWorkerExecuteTimeUnit的默认值为时间单位#纳秒
代码示例来源:origin: eclipse-vertx/vert.x
json.put("maxEventLoopExecuteTimeUnit", obj.getMaxEventLoopExecuteTimeUnit().name());
json.put("maxWorkerExecuteTime", obj.getMaxWorkerExecuteTime());
if (obj.getMaxWorkerExecuteTimeUnit() != null) {
json.put("maxWorkerExecuteTimeUnit", obj.getMaxWorkerExecuteTimeUnit().name());
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Copy constructor
*
* @param other The other {@code VertxOptions} to copy when creating this
*/
public VertxOptions(VertxOptions other) {
this.eventLoopPoolSize = other.getEventLoopPoolSize();
this.workerPoolSize = other.getWorkerPoolSize();
this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval();
this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime();
this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime();
this.internalBlockingPoolSize = other.getInternalBlockingPoolSize();
this.clusterManager = other.getClusterManager();
this.haEnabled = other.isHAEnabled();
this.quorumSize = other.getQuorumSize();
this.haGroup = other.getHAGroup();
this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null;
this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null;
this.warningExceptionTime = other.warningExceptionTime;
this.eventBusOptions = new EventBusOptions(other.eventBusOptions);
this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null;
this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit;
this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit;
this.warningExceptionTimeUnit = other.warningExceptionTimeUnit;
this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit;
}
代码示例来源:origin: eclipse-vertx/vert.x
new VertxThreadFactory("vert.x-worker-thread-", checker, true, options.getMaxWorkerExecuteTime(), options.getMaxWorkerExecuteTimeUnit()));
PoolMetrics workerPoolMetrics = metrics != null ? metrics.createPoolMetrics("worker", "vert.x-worker-thread", options.getWorkerPoolSize()) : null;
ExecutorService internalBlockingExec = Executors.newFixedThreadPool(options.getInternalBlockingPoolSize(),
new VertxThreadFactory("vert.x-internal-blocking-", checker, true, options.getMaxWorkerExecuteTime(), options.getMaxWorkerExecuteTimeUnit()));
PoolMetrics internalBlockingPoolMetrics = metrics != null ? metrics.createPoolMetrics("worker", "vert.x-internal-blocking", options.getInternalBlockingPoolSize()) : null;
internalBlockingPool = new WorkerPool(internalBlockingExec, internalBlockingPoolMetrics);
workerPool = new WorkerPool(workerExec, workerPoolMetrics);
defaultWorkerPoolSize = options.getWorkerPoolSize();
defaultWorkerMaxExecTime = options.getMaxWorkerExecuteTime();
defaultWorkerMaxExecTimeUnit = options.getMaxWorkerExecuteTimeUnit();
代码示例来源:origin: io.vertx/vertx-core
/**
* Copy constructor
*
* @param other The other {@code VertxOptions} to copy when creating this
*/
public VertxOptions(VertxOptions other) {
this.eventLoopPoolSize = other.getEventLoopPoolSize();
this.workerPoolSize = other.getWorkerPoolSize();
this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval();
this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime();
this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime();
this.internalBlockingPoolSize = other.getInternalBlockingPoolSize();
this.clusterManager = other.getClusterManager();
this.haEnabled = other.isHAEnabled();
this.quorumSize = other.getQuorumSize();
this.haGroup = other.getHAGroup();
this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null;
this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null;
this.warningExceptionTime = other.warningExceptionTime;
this.eventBusOptions = new EventBusOptions(other.eventBusOptions);
this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null;
this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit;
this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit;
this.warningExceptionTimeUnit = other.warningExceptionTimeUnit;
this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit;
}
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(null, options.getClusterManager());
assertEquals(2000l * 1000000, options.getMaxEventLoopExecuteTime());
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime());
assertFalse(options.isHAEnabled());
assertEquals(1, options.getQuorumSize());
assertEquals(null, options.getClusterManager());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());
assertEquals(haEnabled, options.isHAEnabled());
assertEquals(fileResolverCachingEnabled, options.isFileResolverCachingEnabled());
代码示例来源: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
@Test
public void testDefaultJsonOptions() {
VertxOptions def = new VertxOptions();
VertxOptions json = new VertxOptions(new JsonObject());
assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize());
assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize());
assertEquals(def.isClustered(), json.isClustered());
assertEquals(def.getClusterHost(), json.getClusterHost());
assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost());
assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort());
assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval());
assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval());
assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval());
assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime());
assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime());
assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize());
assertEquals(def.isHAEnabled(), json.isHAEnabled());
assertEquals(def.getQuorumSize(), json.getQuorumSize());
assertEquals(def.getHAGroup(), json.getHAGroup());
assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime());
assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled());
assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit());
assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit());
assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit());
assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit());
}
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(clusterPublicHost, options.getClusterPublicHost());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());
assertEquals(haEnabled, options.isHAEnabled());
assertEquals(fileResolverCachingEnabled, options.isFileResolverCachingEnabled());
代码示例来源:origin: io.vertx/vertx-core
json.put("maxEventLoopExecuteTimeUnit", obj.getMaxEventLoopExecuteTimeUnit().name());
json.put("maxWorkerExecuteTime", obj.getMaxWorkerExecuteTime());
if (obj.getMaxWorkerExecuteTimeUnit() != null) {
json.put("maxWorkerExecuteTimeUnit", obj.getMaxWorkerExecuteTimeUnit().name());
代码示例来源:origin: io.vertx/vertx-core
new VertxThreadFactory("vert.x-worker-thread-", checker, true, options.getMaxWorkerExecuteTime(), options.getMaxWorkerExecuteTimeUnit()));
PoolMetrics workerPoolMetrics = metrics != null ? metrics.createPoolMetrics("worker", "vert.x-worker-thread", options.getWorkerPoolSize()) : null;
ExecutorService internalBlockingExec = Executors.newFixedThreadPool(options.getInternalBlockingPoolSize(),
new VertxThreadFactory("vert.x-internal-blocking-", checker, true, options.getMaxWorkerExecuteTime(), options.getMaxWorkerExecuteTimeUnit()));
PoolMetrics internalBlockingPoolMetrics = metrics != null ? metrics.createPoolMetrics("worker", "vert.x-internal-blocking", options.getInternalBlockingPoolSize()) : null;
internalBlockingPool = new WorkerPool(internalBlockingExec, internalBlockingPoolMetrics);
workerPool = new WorkerPool(workerExec, workerPoolMetrics);
defaultWorkerPoolSize = options.getWorkerPoolSize();
defaultWorkerMaxExecTime = options.getMaxWorkerExecuteTime();
defaultWorkerMaxExecTimeUnit = options.getMaxWorkerExecuteTimeUnit();
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime()); // 1 minute in nano seconds
rand = TestUtils.randomPositiveInt();
assertEquals(options, options.setMaxWorkerExecuteTime(rand));
assertEquals(rand, options.getMaxWorkerExecuteTime());
try {
options.setMaxWorkerExecuteTime(0);
代码示例来源:origin: io.vertx/vertx-core
assertEquals(null, options.getClusterManager());
assertEquals(2000l * 1000000, options.getMaxEventLoopExecuteTime());
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime());
assertFalse(options.isHAEnabled());
assertEquals(1, options.getQuorumSize());
assertEquals(null, options.getClusterManager());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());
assertEquals(haEnabled, options.isHAEnabled());
assertEquals(fileResolverCachingEnabled, options.isFileResolverCachingEnabled());
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testDefaultJsonOptions() {
VertxOptions def = new VertxOptions();
VertxOptions json = new VertxOptions(new JsonObject());
assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize());
assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize());
assertEquals(def.isClustered(), json.isClustered());
assertEquals(def.getClusterHost(), json.getClusterHost());
assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost());
assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort());
assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval());
assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval());
assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval());
assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime());
assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime());
assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize());
assertEquals(def.isHAEnabled(), json.isHAEnabled());
assertEquals(def.getQuorumSize(), json.getQuorumSize());
assertEquals(def.getHAGroup(), json.getHAGroup());
assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime());
assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled());
assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit());
assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit());
assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit());
assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit());
}
代码示例来源:origin: io.vertx/vertx-core
assertEquals(clusterPublicHost, options.getClusterPublicHost());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());
assertEquals(haEnabled, options.isHAEnabled());
assertEquals(fileResolverCachingEnabled, options.isFileResolverCachingEnabled());
代码示例来源:origin: io.vertx/vertx-core
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime()); // 1 minute in nano seconds
rand = TestUtils.randomPositiveInt();
assertEquals(options, options.setMaxWorkerExecuteTime(rand));
assertEquals(rand, options.getMaxWorkerExecuteTime());
try {
options.setMaxWorkerExecuteTime(0);
内容来源于网络,如有侵权,请联系作者删除!