public void runOnContext(Handler<Void> task) { ContextImpl context = getOrCreateContext(); context.runOnContext(task); }
InternalTimerHandler(long timerID, Handler<Long> runnable, boolean periodic, long delay, ContextImpl context) { this.context = context; this.timerID = timerID; this.handler = runnable; this.periodic = periodic; this.cancelled = new AtomicBoolean(); EventLoop el = context.nettyEventLoop(); Runnable toRun = () -> context.runOnContext(this); if (periodic) { future = el.scheduleAtFixedRate(toRun, delay, delay, TimeUnit.MILLISECONDS); } else { future = el.schedule(toRun, delay, TimeUnit.MILLISECONDS); } }
for (VerticleHolder verticleHolder: verticles) { ContextImpl context = verticleHolder.context; context.runOnContext(v -> { Future<Void> stopFuture = Future.future(); AtomicBoolean failureReported = new AtomicBoolean();
res.setHandler(ar -> runOnContext(v -> resultHandler.handle(ar)));
context.runOnContext(v -> { try { verticle.init(vertx, context);
public void runOnContext(Handler<Void> task) { ContextImpl context = getOrCreateContext(); context.runOnContext(task); }
InternalTimerHandler(long timerID, Handler<Long> runnable, boolean periodic, long delay, ContextImpl context) { this.context = context; this.timerID = timerID; this.handler = runnable; this.periodic = periodic; this.cancelled = new AtomicBoolean(); EventLoop el = context.nettyEventLoop(); Runnable toRun = () -> context.runOnContext(this); if (periodic) { future = el.scheduleAtFixedRate(toRun, delay, delay, TimeUnit.MILLISECONDS); } else { future = el.schedule(toRun, delay, TimeUnit.MILLISECONDS); } if (metrics != null) { metrics.timerCreated(timerID); } }
for (VerticleHolder verticleHolder: verticles) { ContextImpl context = verticleHolder.context; context.runOnContext(v -> { Future<Void> stopFuture = Future.future(); AtomicBoolean failureReported = new AtomicBoolean();
res.setHandler(ar -> runOnContext(v -> resultHandler.handle(ar)));
context.runOnContext(v -> { try { verticle.init(vertx, context);