A callback abstraction that handles completed/failed events of asynchronous operations.
Semantically this is equivalent to an optimise Promise<Void>, but callback is a more meaningful name than EmptyPromise
757677787980818283
/* ------------------------------------------------------------ */ /** Call to signal that a read is now possible. */ public void fillable() { Callback callback=_interested.get(); if (callback!=null && _interested.compareAndSet(callback,null)) callback.succeeded(); }
949596979899100101102
/* ------------------------------------------------------------ */ /** Call to signal a failure to a registered interest */ public void onFail(Throwable cause) { Callback callback=_interested.get(); if (callback!=null && _interested.compareAndSet(callback,null)) callback.failed(cause); }
102103104105106107108109110
} /* ------------------------------------------------------------ */ public void onClose() { Callback callback=_interested.get(); if (callback!=null && _interested.compareAndSet(callback,null)) callback.failed(new ClosedChannelException()); }
333334335336337338339340341342343
{ callback.succeeded(); } else { Callback partial = new Callback.Adapter() { @Override public void failed(Throwable x) { callback.failed(x);
491492493494495496497498499500501
} @Override void onEnter(final AbstractConnection connection) { Callback callback=new Callback() { @Override public void succeeded() { while(true)
9596979899100101102103104105106107
/** Call to signal a failure to a registered interest * @return true if the cause was passed to a {@link Callback} instance */ public boolean onFail(Throwable cause) { Callback callback=_interested.get(); if (callback!=null && _interested.compareAndSet(callback,null)) { callback.failed(cause); return true; } return false; }
107108109110111112113114115
485486487488489490491492493494495
456457458459460461462463464465466