本文整理了Java中io.vertx.core.VertxOptions.getEventLoopPoolSize()
方法的一些代码示例,展示了VertxOptions.getEventLoopPoolSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.getEventLoopPoolSize()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:getEventLoopPoolSize
[英]Get the number of event loop threads to be used by the Vert.x instance.
[中]获取Vert要使用的事件循环线程数。例如。
代码示例来源:origin: eclipse-vertx/vert.x
json.put("eventBusOptions", obj.getEventBusOptions().toJson());
json.put("eventLoopPoolSize", obj.getEventLoopPoolSize());
json.put("fileResolverCachingEnabled", obj.isFileResolverCachingEnabled());
if (obj.getFileSystemOptions() != null) {
代码示例来源:origin: eclipse-vertx/vert.x
private void testConfigureFromSystemProperties(boolean clustered) throws Exception {
// One for each type that we support
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "eventLoopPoolSize", "123");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTime", "123767667");
System.setProperty(RunCommand.METRICS_OPTIONS_PROP_PREFIX + "enabled", "true");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "haGroup", "somegroup");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTimeUnit", "SECONDS");
MyLauncher launcher = new MyLauncher();
String[] args;
if (clustered) {
args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"};
} else {
args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName()};
}
launcher.dispatch(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = launcher.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
}
代码示例来源:origin: eclipse-vertx/vert.x
private void testConfigureFromJson(boolean jsonFile) throws Exception {
JsonObject json = new JsonObject()
.put("eventLoopPoolSize", 123)
.put("maxEventLoopExecuteTime", 123767667)
.put("metricsOptions", new JsonObject().put("enabled", true))
.put("eventBusOptions", new JsonObject().put("clustered", true).put("clusterPublicHost", "mars"))
.put("haGroup", "somegroup")
.put("maxEventLoopExecuteTimeUnit", "SECONDS");
String optionsArg;
if (jsonFile) {
File file = testFolder.newFile();
Files.write(file.toPath(), json.toBuffer().getBytes());
optionsArg = file.getPath();
} else {
optionsArg = json.toString();
}
MyLauncher launcher = new MyLauncher();
String[] args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName(), "-options", optionsArg};
launcher.dispatch(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = launcher.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals(true, opts.isClustered());
assertEquals("mars", opts.getClusterPublicHost());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
}
代码示例来源:origin: eclipse-vertx/vert.x
private void testConfigureFromSystemProperties(boolean clustered) throws Exception {
// One for each type that we support
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "eventLoopPoolSize", "123");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTime", "123767667");
System.setProperty(Starter.METRICS_OPTIONS_PROP_PREFIX + "enabled", "true");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "haGroup", "somegroup");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTimeUnit", "SECONDS");
MyStarter starter = new MyStarter();
String[] args;
if (clustered) {
args = new String[] {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"};
} else {
args = new String[] {"run", "java:" + TestVerticle.class.getCanonicalName()};
}
starter.run(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = starter.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
cleanup(starter);
}
代码示例来源: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
assertEquals(20000, options.getClusterPingInterval());
assertEquals(20000, options.getClusterPingReplyInterval());
assertEquals(2 * Runtime.getRuntime().availableProcessors(), options.getEventLoopPoolSize());
assertEquals(20, options.getInternalBlockingPoolSize());
assertEquals(20, options.getWorkerPoolSize());
assertEquals(clusterPingInterval, options.getClusterPingInterval());
assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());
assertEquals(eventLoopPoolSize, options.getEventLoopPoolSize());
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize());
assertEquals(workerPoolSize, options.getWorkerPoolSize());
代码示例来源:origin: eclipse-vertx/vert.x
checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit());
eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
ThreadFactory acceptorEventLoopThreadFactory = new VertxThreadFactory("vert.x-acceptor-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
代码示例来源:origin: resteasy/Resteasy
.setInstances(vertxOptions.getEventLoopPoolSize())
.setConfig(new JsonObject().put("helper", key));
vertx.deployVerticle(Verticle.class.getName(), deploymentOptions, ar -> {
代码示例来源: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(clusterPingInterval, options.getClusterPingInterval());
assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());
assertEquals(eventLoopPoolSize, options.getEventLoopPoolSize());
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize());
assertEquals(workerPoolSize, options.getWorkerPoolSize());
代码示例来源:origin: io.vertx/vertx-core
json.put("eventBusOptions", obj.getEventBusOptions().toJson());
json.put("eventLoopPoolSize", obj.getEventLoopPoolSize());
json.put("fileResolverCachingEnabled", obj.isFileResolverCachingEnabled());
if (obj.getFileSystemOptions() != null) {
代码示例来源:origin: io.vertx/vertx-core
private void testConfigureFromJson(boolean jsonFile) throws Exception {
JsonObject json = new JsonObject()
.put("eventLoopPoolSize", 123)
.put("maxEventLoopExecuteTime", 123767667)
.put("metricsOptions", new JsonObject().put("enabled", true))
.put("eventBusOptions", new JsonObject().put("clustered", true).put("clusterPublicHost", "mars"))
.put("haGroup", "somegroup")
.put("maxEventLoopExecuteTimeUnit", "SECONDS");
String optionsArg;
if (jsonFile) {
File file = testFolder.newFile();
Files.write(file.toPath(), json.toBuffer().getBytes());
optionsArg = file.getPath();
} else {
optionsArg = json.toString();
}
MyLauncher launcher = new MyLauncher();
String[] args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName(), "-options", optionsArg};
launcher.dispatch(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = launcher.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals(true, opts.isClustered());
assertEquals("mars", opts.getClusterPublicHost());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
}
代码示例来源:origin: io.vertx/vertx-core
private void testConfigureFromSystemProperties(boolean clustered) throws Exception {
// One for each type that we support
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "eventLoopPoolSize", "123");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTime", "123767667");
System.setProperty(RunCommand.METRICS_OPTIONS_PROP_PREFIX + "enabled", "true");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "haGroup", "somegroup");
System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTimeUnit", "SECONDS");
MyLauncher launcher = new MyLauncher();
String[] args;
if (clustered) {
args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"};
} else {
args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName()};
}
launcher.dispatch(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = launcher.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
}
代码示例来源:origin: io.vertx/vertx-core
private void testConfigureFromSystemProperties(boolean clustered) throws Exception {
// One for each type that we support
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "eventLoopPoolSize", "123");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTime", "123767667");
System.setProperty(Starter.METRICS_OPTIONS_PROP_PREFIX + "enabled", "true");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "haGroup", "somegroup");
System.setProperty(Starter.VERTX_OPTIONS_PROP_PREFIX + "maxEventLoopExecuteTimeUnit", "SECONDS");
MyStarter starter = new MyStarter();
String[] args;
if (clustered) {
args = new String[] {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"};
} else {
args = new String[] {"run", "java:" + TestVerticle.class.getCanonicalName()};
}
starter.run(args);
assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
VertxOptions opts = starter.getVertxOptions();
assertEquals(123, opts.getEventLoopPoolSize(), 0);
assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
assertEquals(true, opts.getMetricsOptions().isEnabled());
assertEquals("somegroup", opts.getHAGroup());
assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
cleanup(starter);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testOptions() {
VertxOptions options = new VertxOptions();
assertEquals(2 * Runtime.getRuntime().availableProcessors(), options.getEventLoopPoolSize());
int rand = TestUtils.randomPositiveInt();
assertEquals(options, options.setEventLoopPoolSize(rand));
assertEquals(rand, options.getEventLoopPoolSize());
try {
options.setEventLoopPoolSize(0);
代码示例来源: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: io.vertx/vertx-core
assertEquals(20000, options.getClusterPingInterval());
assertEquals(20000, options.getClusterPingReplyInterval());
assertEquals(2 * Runtime.getRuntime().availableProcessors(), options.getEventLoopPoolSize());
assertEquals(20, options.getInternalBlockingPoolSize());
assertEquals(20, options.getWorkerPoolSize());
assertEquals(clusterPingInterval, options.getClusterPingInterval());
assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());
assertEquals(eventLoopPoolSize, options.getEventLoopPoolSize());
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize());
assertEquals(workerPoolSize, options.getWorkerPoolSize());
代码示例来源:origin: io.vertx/vertx-core
checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit());
eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
ThreadFactory acceptorEventLoopThreadFactory = new VertxThreadFactory("vert.x-acceptor-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
代码示例来源: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(clusterPingInterval, options.getClusterPingInterval());
assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());
assertEquals(eventLoopPoolSize, options.getEventLoopPoolSize());
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize());
assertEquals(workerPoolSize, options.getWorkerPoolSize());
内容来源于网络,如有侵权,请联系作者删除!