@Override public void deployVerticle(Verticle verticle, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { if (options.getInstances() != 1) { throw new IllegalArgumentException("Can't specify > 1 instances for already created verticle"); } deployVerticle(() -> verticle, options, completionHandler); }
public int getInstanceCount() { // the no verticle case if (deployment == null) { return 0; } // the single verticle without an instance flag explicitly defined if (deployment.deploymentOptions() == null) { return 1; } return deployment.deploymentOptions().getInstances(); } }
public void deployVerticle(Supplier<Verticle> verticleSupplier, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { if (options.getInstances() < 1) { throw new IllegalArgumentException("Can't specify < 1 instances to deploy"); int nbInstances = options.getInstances(); Set<Verticle> verticles = Collections.newSetFromMap(new IdentityHashMap<>()); for (int i = 0; i < nbInstances; i++) {
static void toJson(DeploymentOptions obj, java.util.Map<String, Object> json) { if (obj.getConfig() != null) { json.put("config", obj.getConfig()); } if (obj.getExtraClasspath() != null) { JsonArray array = new JsonArray(); obj.getExtraClasspath().forEach(item -> array.add(item)); json.put("extraClasspath", array); } json.put("ha", obj.isHa()); json.put("instances", obj.getInstances()); if (obj.getIsolatedClasses() != null) { JsonArray array = new JsonArray(); obj.getIsolatedClasses().forEach(item -> array.add(item)); json.put("isolatedClasses", array); } if (obj.getIsolationGroup() != null) { json.put("isolationGroup", obj.getIsolationGroup()); } json.put("maxWorkerExecuteTime", obj.getMaxWorkerExecuteTime()); if (obj.getMaxWorkerExecuteTimeUnit() != null) { json.put("maxWorkerExecuteTimeUnit", obj.getMaxWorkerExecuteTimeUnit().name()); } json.put("worker", obj.isWorker()); if (obj.getWorkerPoolName() != null) { json.put("workerPoolName", obj.getWorkerPoolName()); } json.put("workerPoolSize", obj.getWorkerPoolSize()); } }
vertx.<Verticle[]>executeBlocking(createFut -> { try { Verticle[] verticles = createVerticles(verticleFactory, identifier, options.getInstances(), cl); createFut.complete(verticles); } catch (Exception e) { } else { try { Verticle[] verticles = createVerticles(verticleFactory, identifier, options.getInstances(), cl); doDeploy(identifier, options, parentContext, callingContext, completionHandler, cl, verticles); return;
@Override public void deployVerticle(Verticle verticle, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { if (options.getInstances() != 1) { throw new IllegalArgumentException("Can't specify > 1 instances for already created verticle"); } deployVerticle(() -> verticle, options, completionHandler); }
public int getInstanceCount() { // the no verticle case if (deployment == null) { return 0; } // the single verticle without an instance flag explicitly defined if (deployment.deploymentOptions() == null) { return 1; } return deployment.deploymentOptions().getInstances(); } }
public void deployVerticle(Supplier<Verticle> verticleSupplier, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { if (options.getInstances() < 1) { throw new IllegalArgumentException("Can't specify < 1 instances to deploy"); int nbInstances = options.getInstances(); Set<Verticle> verticles = Collections.newSetFromMap(new IdentityHashMap<>()); for (int i = 0; i < nbInstances; i++) {
json.put("instances", obj.getInstances()); if (obj.getIsolatedClasses() != null) { JsonArray array = new JsonArray();
vertx.<Verticle[]>executeBlocking(createFut -> { try { Verticle[] verticles = createVerticles(verticleFactory, identifier, options.getInstances(), cl); createFut.complete(verticles); } catch (Exception e) { } else { try { Verticle[] verticles = createVerticles(verticleFactory, identifier, options.getInstances(), cl); doDeploy(identifier, options, parentContext, callingContext, completionHandler, cl, verticles); return;
static void deploy(final Vertx vertx, final Class<?> clazz, final DeploymentOptions options, final Annal logger) { final String name = clazz.getName(); final String flag = options.isWorker() ? "Rx-Worker" : "Rx-Agent"; final Single<String> observable = vertx.rxDeployVerticle(clazz.getName(), options); observable.subscribe( (item) -> logger.info(Info.VTC_END, name, options.getInstances(), item, flag), (cause) -> logger.info(Info.VTC_FAIL, name, options.getInstances(), null == cause.getCause() ? null : cause.getCause().getMessage(), flag)); } }
private Future<Void> deployVerticleIfNeeded(String verticle, DeploymentOptions options) { Future<Void> future = Future.future(); if (options.getInstances() == 0) { future.complete(); } else { vertx.deployVerticle(verticle, options, reporter(future)); } return future; }
static void deploy(final Vertx vertx, final Class<?> clazz, final DeploymentOptions options, final Annal logger) { final String name = clazz.getName(); final String flag = options.isWorker() ? "Rx-Worker" : "Rx-Agent"; final Single<String> observable = vertx.rxDeployVerticle(clazz.getName(), options); observable.subscribe( (item) -> logger.info(Info.VTC_END, name, options.getInstances(), item, flag), (cause) -> logger.info(Info.VTC_FAIL, name, options.getInstances(), null == cause.getCause() ? null : cause.getCause().getMessage(), flag)); } }
static void deploy(final Vertx vertx, final Class<?> clazz, final DeploymentOptions option, final Annal logger) { // Verticle deployment final String name = clazz.getName(); final String flag = option.isWorker() ? "Worker" : "Agent"; // Multi Thread worker enabled for trying. if (option.isWorker()) { option.setMultiThreaded(true); } vertx.deployVerticle(name, option, (result) -> { // Success or Failed. if (result.succeeded()) { logger.info(Info.VTC_END, name, option.getInstances(), result.result(), flag); INSTANCES.put(clazz, result.result()); } else { logger.warn(Info.VTC_FAIL, name, option.getInstances(), result.result(), null == result.cause() ? null : result.cause().getMessage(), flag); } }); }
static void deploy(final Vertx vertx, final Class<?> clazz, final DeploymentOptions option, final Annal logger) { // Verticle deployment final String name = clazz.getName(); final String flag = option.isWorker() ? "Worker" : "Agent"; // Multi Thread worker enabled for trying. if (option.isWorker()) { option.setMultiThreaded(true); } vertx.deployVerticle(name, option, (result) -> { // Success or Failed. if (result.succeeded()) { logger.info(Info.VTC_END, name, option.getInstances(), result.result(), flag); INSTANCES.put(clazz, result.result()); } else { logger.warn(Info.VTC_FAIL, name, option.getInstances(), result.result(), null == result.cause() ? null : result.cause().getMessage(), flag); } }); }
if(worker != DeploymentOptions.DEFAULT_WORKER) options.setWorker(worker); if(multiWork != DeploymentOptions.DEFAULT_MULTI_THREADED) options.setMultiThreaded(multiWork); if(requireSingle && options.getInstances() != 1) throw new IllegalStateException("verticleName must be single instance");