CountingCallback

<p> A callback wrapper that succeeds the wrapped callback when the count is reached, or on first failure. </p> <p> This callback is particularly useful when an async operation is split into multiple parts, for example when an original byte buffer that needs to be written, along with a callback, is split into multiple byte buffers, since it allows the original callback to be wrapped and notified only when the last part has been processed. </p> <p>

Constructors

this
this(Callback callback, int count)
Undocumented in source.

Members

Functions

failed
void failed(Exception failure)
Undocumented in source. Be warned that the author may not have intended to support it.
succeeded
void succeeded()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From NestedCallback

getCallback
Callback getCallback()
Undocumented in source. Be warned that the author may not have intended to support it.
succeeded
void succeeded()
Undocumented in source. Be warned that the author may not have intended to support it.
failed
void failed(Exception x)
Undocumented in source. Be warned that the author may not have intended to support it.
isNonBlocking
bool isNonBlocking()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

</p>

<pre> void process(EndPoint endPoint, ByteBuffer buffer, Callback callback) { ByteBuffer[] buffers = split(buffer); CountCallback countCallback = new CountCallback(callback, buffers.length); endPoint.write(countCallback, buffers); } </pre>

Meta