public void deployVerticle(String identifier, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { ContextInternal callingContext = vertx.getOrCreateContext(); ClassLoader cl = getClassLoader(options); doDeployVerticle(identifier, options, callingContext, callingContext, cl, completionHandler); }
@Override public <T> void executeBlockingInternal(Handler<Future<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler) { ContextImpl context = getOrCreateContext(); context.executeBlockingInternal(blockingCodeHandler, resultHandler); }
/** * Set the send timeout. * * @param timeout the timeout value, in ms. * @return a reference to this, so the API can be used fluently */ public DeliveryOptions setSendTimeout(long timeout) { Arguments.require(timeout >= 1, "sendTimeout must be >= 1"); this.timeout = timeout; return this; }
@Override public void undeploy(Handler<AsyncResult<Void>> completionHandler) { ContextInternal currentContext = vertx.getOrCreateContext(); doUndeploy(currentContext, completionHandler); }
@Override public boolean tryFail(String failureMessage) { return tryFail(new NoStackTraceThrowable(failureMessage)); }
@Override public boolean tryFail(String failureMessage) { return tryFail(new NoStackTraceThrowable(failureMessage)); }
private void addToHADeployList(final String verticleName, final DeploymentOptions deploymentOptions, final Handler<AsyncResult<String>> doneHandler) { toDeployOnQuorum.add(() -> { ContextInternal ctx = vertx.getContext(); try { ContextImpl.setContext(null); deployVerticle(verticleName, deploymentOptions, doneHandler); } finally { ContextImpl.setContext((ContextImpl) ctx); } }); }
@Override public void deployVerticle(String name, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler) { if (options.isHa() && haManager() != null && haManager().isEnabled()) { haManager().deployVerticle(name, options, completionHandler); } else { deploymentManager.deployVerticle(name, options, completionHandler); } }
@Override public <T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler) { executeBlocking(blockingCodeHandler, resultHandler, workerPool.executor(), ordered ? orderedTasks : null, workerPool.metrics()); }
@Override public void failDuringFailover(boolean fail) { if (haManager() != null) { haManager().failDuringFailover(fail); } }
public void runCloseHooks(Handler<AsyncResult<Void>> completionHandler) { closeHooks.run(completionHandler); // Now remove context references from threads VertxThreadFactory.unsetContext(this); }
@Override public <T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> asyncResultHandler) { ContextImpl context = getOrCreateContext(); context.executeBlocking(blockingCodeHandler, ordered, asyncResultHandler); }
public void simulateKill() { if (haManager() != null) { haManager().simulateKill(); } }
@Override public synchronized void failoverCompleteHandler(FailoverCompleteHandler failoverCompleteHandler) { if (haManager() != null) { haManager().setFailoverCompleteHandler(failoverCompleteHandler); } }
public void runOnContext(Handler<Void> task) { ContextImpl context = getOrCreateContext(); context.runOnContext(task); }
/** * Like {@link #join(Future, Future)} but with 5 futures. */ static <T1, T2, T3, T4, T5> CompositeFuture join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5) { return CompositeFutureImpl.join(f1, f2, f3, f4, f5); }
@Override public <T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, TaskQueue queue, Handler<AsyncResult<T>> resultHandler) { executeBlocking(blockingCodeHandler, resultHandler, workerPool.executor(), queue, workerPool.metrics()); }
@Override public <T> void executeBlockingInternal(Handler<Future<T>> action, Handler<AsyncResult<T>> resultHandler) { executeBlocking(action, resultHandler, internalBlockingPool.executor(), internalOrderedTasks, internalBlockingPool.metrics()); }