@Override public void operationComplete(ChannelGroupFuture future) throws Exception { NetworkMultipleEvent.this.groupFuture = future; if (listener != null) { listener.operationComplete(future); } }
/** * Set the condition value. * * @param conditionSatisfied if the condition is satisfied. */ public final void setCondition(final boolean conditionSatisfied) { synchronized (conditionSetLock) { condition = conditionSatisfied; conditionSetFlag = true; if (condition) { for (final ChannelGroupFutureListener l : listeners.keySet()) { backedChannelGroupFuture.addListener(l); } listeners.clear(); } else { for (final ChannelGroupFutureListener l : listeners.keySet()) { try { l.operationComplete(this); } catch (final Throwable t) { LOGGER.warn("Exception occured when executing ChannelGroupFutureListener", t); } } } conditionSetLock.notifyAll(); } }
@Override public final void addListener(final ChannelGroupFutureListener listener) { synchronized (conditionSetLock) { if (!conditionSetFlag) { listeners.put(listener, listener); return; } } if (condition) { backedChannelGroupFuture.addListener(listener); } else { try { listener.operationComplete(this); } catch (final Throwable t) { LOGGER.warn("Exception occured when executing ChannelGroupFutureListener", t); } } }