@Override public ChannelHandler addListener(final ChannelHandlerListener listener) { ioFuture.addListener(new IoFutureListener<IoFuture>() { @Override public void operationComplete(final IoFuture future) {
public void operationComplete(IoFuture future) { removeSession((AbstractIoSession) future.getSession()); } }
this.disposalFuture = disposalFuture = dispose0(); } catch (Exception e) { IoSession ioSession = this.disposalFuture != null ? this.disposalFuture.getSession() : null; ExceptionMonitor.getInstance().exceptionCaught(e, ioSession); } finally { disposalFuture.awaitUninterruptibly();
private static boolean await0(Iterable<? extends IoFuture> futures, long timeoutMillis, boolean interruptable) throws InterruptedException { long startTime = timeoutMillis <= 0 ? 0 : System.currentTimeMillis(); long waitTime = timeoutMillis; boolean lastComplete = true; Iterator<? extends IoFuture> i = futures.iterator(); while (i.hasNext()) { IoFuture f = i.next(); do { if (interruptable) { lastComplete = f.await(waitTime); } else { lastComplete = f.awaitUninterruptibly(waitTime); } waitTime = timeoutMillis - (System.currentTimeMillis() - startTime); if (lastComplete || waitTime <= 0) { break; } } while (!lastComplete); if (waitTime <= 0) { break; } } return lastComplete && !i.hasNext(); }
/** * Wait on all the {@link IoFuture}s we get. This can't get interrupted. * * @param futures The {@link IoFuture}s we are waiting on */ public static void awaitUninterruptably(Iterable<? extends IoFuture> futures) { for (IoFuture f : futures) { f.awaitUninterruptibly(); } }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static void await(Iterable<? extends IoFuture> futures) throws InterruptedException { for (IoFuture f : futures) { f.await(); } }
public IoFutureListener<?> onfuture(State success) { return f -> { if (f.isDone()) { success.activate(); } }; }
/** * {@inheritDoc} */ @Override public void operationComplete(IoFuture future) { future.getSession().closeNow(); } };
lastComplete = f.await(waitTime); } else { lastComplete = f.awaitUninterruptibly(waitTime);
public static void awaitUninterruptably(Iterable<? extends IoFuture> futures) { for (IoFuture f: futures) { f.awaitUninterruptibly(); } }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static void await(Iterable<? extends IoFuture> futures) throws InterruptedException { for (IoFuture f : futures) { f.await(); } }
@Override public void operationComplete(IoFuture future) { if (future.isDone()) { if (logger.isInfoEnabled()) { logger.info("[JobX] MinaRPC sent success, request id:{}", rpcFuture.getRequest().getId()); } return; } else { if (logger.isInfoEnabled()) { logger.info("[JobX] MinaRPC sent failure, request id:{}", rpcFuture.getRequest().getId()); } if (rpcFuture != null) { rpcFuture.caught(getConnect(rpcFuture.getRequest()).getException()); } } futureTable.remove(rpcFuture.getRequest().getId()); }
/** * {@inheritDoc} */ @Override public void operationComplete(IoFuture future) { removeSession((AbstractIoSession) future.getSession()); }
@Override public ChannelHandler addListener(final ChannelHandlerListener listener) { ioFuture.addListener(new IoFutureListener<IoFuture>() { @Override public void operationComplete(final IoFuture future) {
lastComplete = f.await(waitTime); } else { lastComplete = f.awaitUninterruptibly(waitTime);
/** * Wait on all the {@link IoFuture}s we get. This can't get interrupted. * * @param futures The {@link IoFuture}s we are waiting on */ public static void awaitUninterruptably(Iterable<? extends IoFuture> futures) { for (IoFuture f : futures) { f.awaitUninterruptibly(); } }
public static void await(Iterable<? extends IoFuture> futures) throws InterruptedException { for (IoFuture f: futures) { f.await(); } }
public void operationComplete(IoFuture future) { synchronized (TAKEN_LOCAL_ADDRESSES) { TAKEN_LOCAL_ADDRESSES.remove(future.getSession().getLocalAddress()); } } }
/** * Adds required internal attributes and {@link IoFutureListener}s * related with event notifications to the specified {@code session} * and {@code future}. Do not call this method directly; */ @Override protected final void finishSessionInitialization0(final IoSession session, IoFuture future) { // In case that ConnectFuture.cancel() is invoked before // setSession() is invoked, add a listener that closes the // connection immediately on cancellation. future.addListener(new IoFutureListener<ConnectFuture>() { /** * {@inheritDoc} */ @Override public void operationComplete(ConnectFuture future) { if (future.isCanceled()) { session.closeNow(); } } }); }
disposalFuture.awaitUninterruptibly();