本文整理了Java中io.vertx.core.VertxOptions.setWorkerPoolSize()
方法的一些代码示例,展示了VertxOptions.setWorkerPoolSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.setWorkerPoolSize()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:setWorkerPoolSize
[英]Set the maximum number of worker threads to be used by the Vert.x instance.
[中]设置Vert要使用的最大工作线程数。例如。
代码示例来源:origin: eclipse-vertx/vert.x
case "workerPoolSize":
if (member.getValue() instanceof Number) {
obj.setWorkerPoolSize(((Number)member.getValue()).intValue());
代码示例来源:origin: advantageous/qbit
@Before
public void setup() throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
port = PortUtils.findOpenPortStartAt(9000);
testVerticle = new TestVerticle(port, latch);
vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(5));
vertx.deployVerticle(testVerticle, res -> {
if (res.succeeded()) {
System.out.println("Deployment id is: " + res.result());
} else {
System.out.println("Deployment failed!");
res.cause().printStackTrace();
}
latch.countDown();
});
latch.await(5, TimeUnit.SECONDS);
}
代码示例来源:origin: advantageous/qbit
@Before
public void setup() throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
port = PortUtils.findOpenPortStartAt(9000);
testVerticle = new TestVerticle(port, latch);
vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(5));
vertx.deployVerticle(testVerticle, res -> {
if (res.succeeded()) {
System.out.println("Deployment id is: " + res.result());
} else {
System.out.println("Deployment failed!");
res.cause().printStackTrace();
}
latch.countDown();
});
latch.await(5, TimeUnit.SECONDS);
}
代码示例来源:origin: advantageous/qbit
@Before
public void setup() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
port = PortUtils.findOpenPortStartAt(9000);
testVerticle = new TestVerticle(port);
vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(5));
vertx.deployVerticle(testVerticle, res -> {
if (res.succeeded()) {
System.out.println("Deployment id is: " + res.result());
} else {
System.out.println("Deployment failed!");
res.cause().printStackTrace();
}
latch.countDown();
});
latch.await(5, TimeUnit.SECONDS);
}
代码示例来源:origin: advantageous/qbit
@Before
public void setup() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
port = PortUtils.findOpenPortStartAt(9000);
testVerticle = new TestVerticle(port);
vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(5));
vertx.deployVerticle(testVerticle, res -> {
if (res.succeeded()) {
System.out.println("Deployment id is: " + res.result());
} else {
System.out.println("Deployment failed!");
res.cause().printStackTrace();
}
latch.countDown();
});
latch.await(5, TimeUnit.SECONDS);
}
代码示例来源:origin: io.vertx/vertx-core
case "workerPoolSize":
if (member.getValue() instanceof Number) {
obj.setWorkerPoolSize(((Number)member.getValue()).intValue());
代码示例来源:origin: eclipse-vertx/vert.x
options.setEventLoopPoolSize(eventLoopPoolSize);
options.setInternalBlockingPoolSize(internalBlockingPoolSize);
options.setWorkerPoolSize(workerPoolSize);
options.setBlockedThreadCheckInterval(blockedThreadCheckInterval);
options.setClusterHost(clusterHost);
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(options, options.setWorkerPoolSize(rand));
assertEquals(rand, options.getWorkerPoolSize());
try {
options.setWorkerPoolSize(0);
fail("Should throw exception");
} catch (IllegalArgumentException e) {
代码示例来源:origin: vietj/advanced-vertx-guide
public static void worker() {
Vertx vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(10));
}
}
代码示例来源:origin: EnMasseProject/enmasse
public static Vertx create() {
VertxOptions options = new VertxOptions()
.setWorkerPoolSize(1)
.setInternalBlockingPoolSize(1)
.setEventLoopPoolSize(1);
return Vertx.vertx(options);
}
}
代码示例来源:origin: vietj/advanced-vertx-guide
public static void main(String[] args) {
Vertx vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(2));
vertx.deployVerticle(
TheWorker.class.getName(),
new DeploymentOptions().setWorker(true).setInstances(4)
);
AtomicInteger count = new AtomicInteger(10);
for (int i = 0;i < 10;i++) {
vertx.eventBus().send("the-address", "the-message", reply -> {
System.out.println(reply.result().body());
if (count.decrementAndGet() == 0) {
System.exit(0);
}
});
}
}
代码示例来源:origin: vietj/advanced-vertx-guide
public static void source() {
Vertx vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(2));
vertx.deployVerticle(
TheWorker.class.getName(),
new DeploymentOptions().setWorker(true).setInstances(4)
);
for (int i = 0;i < 10;i++) {
vertx.eventBus().send("the-address", "the-message", reply -> {
System.out.println(reply.result().body());
});
}
}
}
代码示例来源:origin: io.helixservice/helix-core
@Override
public void run() {
long start = System.currentTimeMillis();
serverState = ServerState.STARTING;
LOG.info("Starting Helix Server");
HelixServer.this.instantiateFeatures();
for (Feature feature : features) {
feature.logFeatureDetails(LOG);
Multimap<String, Component> registrationMap = feature.getRegistrationMap();
HelixServer.this.registrationMap.putAll(registrationMap);
}
// Start bootstrap features
if (!bootstrapFeaturesStarted) {
for (Feature bootstrapFeature : bootstrapFeatures) {
bootstrapFeature.start(HelixServer.this);
}
bootstrapFeaturesStarted = true;
}
// Initialize Vertx
String numWorkers = System.getProperty("vertx.server.workers", "50");
VertxOptions options = new VertxOptions().setWorkerPoolSize(Integer.parseInt(numWorkers));
vertx = Vertx.vertx(options);
// Start core features
for (Feature coreFeature : coreFeatures) {
coreFeature.start(HelixServer.this);
}
serverState = ServerState.STARTED;
LOG.info("Helix Server started in " + (System.currentTimeMillis() - start) + " ms");
}
});
代码示例来源:origin: PerfCake/PerfCake
VertxOptions vertxOptions = new VertxOptions().setWorkerPoolSize(threads);
vertx = Vertx.vertx(vertxOptions);
server = vertx.createHttpServer();
代码示例来源:origin: io.vertx/vertx-core
options.setEventLoopPoolSize(eventLoopPoolSize);
options.setInternalBlockingPoolSize(internalBlockingPoolSize);
options.setWorkerPoolSize(workerPoolSize);
options.setBlockedThreadCheckInterval(blockedThreadCheckInterval);
options.setClusterHost(clusterHost);
代码示例来源: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
assertEquals(options, options.setWorkerPoolSize(rand));
assertEquals(rand, options.getWorkerPoolSize());
try {
options.setWorkerPoolSize(0);
fail("Should throw exception");
} catch (IllegalArgumentException e) {
内容来源于网络,如有侵权,请联系作者删除!