case "workerPoolSize": if (member.getValue() instanceof Number) { obj.setWorkerPoolSize(((Number)member.getValue()).intValue());
@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); }
@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); }
@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); }
@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); }
case "workerPoolSize": if (member.getValue() instanceof Number) { obj.setWorkerPoolSize(((Number)member.getValue()).intValue());
options.setEventLoopPoolSize(eventLoopPoolSize); options.setInternalBlockingPoolSize(internalBlockingPoolSize); options.setWorkerPoolSize(workerPoolSize); options.setBlockedThreadCheckInterval(blockedThreadCheckInterval); options.setClusterHost(clusterHost);
assertEquals(options, options.setWorkerPoolSize(rand)); assertEquals(rand, options.getWorkerPoolSize()); try { options.setWorkerPoolSize(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {
public static void worker() { Vertx vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(10)); } }
public static Vertx create() { VertxOptions options = new VertxOptions() .setWorkerPoolSize(1) .setInternalBlockingPoolSize(1) .setEventLoopPoolSize(1); return Vertx.vertx(options); } }
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); } }); } }
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()); }); } } }
@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"); } });
VertxOptions vertxOptions = new VertxOptions().setWorkerPoolSize(threads); vertx = Vertx.vertx(vertxOptions); server = vertx.createHttpServer();
options.setEventLoopPoolSize(eventLoopPoolSize); options.setInternalBlockingPoolSize(internalBlockingPoolSize); options.setWorkerPoolSize(workerPoolSize); options.setBlockedThreadCheckInterval(blockedThreadCheckInterval); options.setClusterHost(clusterHost);
@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); }
assertEquals(options, options.setWorkerPoolSize(rand)); assertEquals(rand, options.getWorkerPoolSize()); try { options.setWorkerPoolSize(0); fail("Should throw exception"); } catch (IllegalArgumentException e) {