Auth(final String sessionID, final SockJSSocket sock) { timerID = vertx.setTimer(authTimeout, new Handler<Long>() { public void handle(Long id) { uncacheAuthorisation(sessionID, sock); } }); }
@Override public void execute() { timerRef.set(RxTimer.this.core.setTimer(delay,this)); } @Override public void handle(Long res) {
private void checkAddAccceptedReplyAddress(final String replyAddress) { if (replyAddress != null) { // This message has a reply address // When the reply comes through we want to accept it irrespective of its address // Since all replies are implicitly accepted if the original message was accepted // So we cache the reply address, so we can check against it acceptedReplyAddresses.add(replyAddress); // And we remove after timeout in case the reply never comes vertx.setTimer(DEFAULT_REPLY_TIMEOUT, new Handler<Long>() { public void handle(Long id) { acceptedReplyAddresses.remove(replyAddress); } }); } }
@Override public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { timers.add(vertx.setTimer(unit.toMillis(delayTime),new Handler<Long>() { public void handle(Long id) { if (innerSubscription.isUnsubscribed()) return; action.call(); timers.remove(id); } })); return this.innerSubscription; }
private void setTimer() { if (timeout != -1) { cancelTimer(); timeoutTimerID = vertx.setTimer(timeout, new Handler<Long>() { public void handle(Long id) { vertx.cancelTimer(heartbeatID); if (listener == null) { shutdown(); } if (listener != null) { listener.close(); } } }); } }
@Override public Subscription schedulePeriodically(final Action0 action, long initialDelay, final long delayTime, final TimeUnit unit) { // Use a bootstrap handler to start the periodic timer after initialDelay Handler bootstrap=new Handler<Long>() { public void handle(Long id) { action.call(); // Ensure still active if (innerSubscription.isUnsubscribed()) return; // Start the repeating timer timers.add(vertx.setPeriodic(unit.toMillis(delayTime),new Handler<Long>() { public void handle(Long nestedId) { if (innerSubscription.isUnsubscribed()) return; action.call(); } })); } }; long bootDelay=unit.toMillis(initialDelay); // If initialDelay is 0 then fire bootstrap immediately if (bootDelay<1) { vertx.runOnContext(bootstrap); } else { timers.add(vertx.setTimer(bootDelay,bootstrap)); } return this.innerSubscription; }
/** * {@inheritDoc} */ @Override public boolean suspend(long timeOut, TimeUnit timeUnit, TimeoutHandler timeoutHandler) { // TODO: If already suspended should return false according to documentation // Store the timeout handler this.timeoutHandler = timeoutHandler; // Cancel any existing timer if (suspendTimerId != 0) { vertx.cancelTimer(suspendTimerId); suspendTimerId = 0; } // If timeout <= 0, then it suspends indefinitely if (timeOut <= 0) { return true; } // Get milliseconds long ms = timeUnit.toMillis(timeOut); // Schedule timeout on the event loop this.suspendTimerId = vertx.setTimer(ms, new Handler<Long>() { @Override public void handle(Long id) { if (id == suspendTimerId) { VertxResponseWriter.this.timeoutHandler.onTimeout(VertxResponseWriter.this); } } }); return true; }
/** * Sets a timed handler. */ public static LongValue setTimer(Env env, LongValue delay, Value handler) { PhpTypes.assertCallable(env, handler, "Handler argument to Vertx::runOnContext() must be callable."); PhpVerticleFactory.vertx.setTimer(delay.toLong(), HandlerFactory.<Long>createGenericHandler(env, handler)); return delay; }
vertx.setTimer(connectionTimeout, new Handler<Long>() { public void handle(Long timerID) { if( socketsConnecting.contains(socket) ) {
vertx.setTimer(connectionTimeout, new Handler<Long>() { public void handle(Long timerID) { handleConnectFailure(socket, String.format("Gateway client '%s' protocol detection timeout.", socket.remoteAddress()));
vertx.setTimer(status.getConnectionTimeout(), new Handler<Long>() { public void handle(Long timerID) { if (socketsConnecting.contains(socket)) {
vertx.setTimer(status.getConnectionTimeout(), new Handler<Long>() { public void handle(Long timerID) { if (socketsConnecting.contains(socket)) {