private class HttpOutput.ReadableByteChannelWritingCB extends IteratingNestedCallback
HttpChannel.
A ByteBuffer of size HttpOutput.getBufferSize() is used that will be direct if
HttpChannel.useDirectBuffers() is true.
This callback is passed to the HttpChannel.write(ByteBuffer, boolean, Callback) to
be notified as each buffer is written and only once all the input is consumed will the
wrapped Callback.succeeded() method be called.IteratingCallback.ActionCallback.Completable, Callback.NestedInvocable.InvocationType| Modifier and Type | Field and Description |
|---|---|
private java.nio.ByteBuffer |
_buffer |
private boolean |
_eof |
private java.nio.channels.ReadableByteChannel |
_in |
__nonBlocking| Constructor and Description |
|---|
ReadableByteChannelWritingCB(java.nio.channels.ReadableByteChannel in,
Callback callback) |
| Modifier and Type | Method and Description |
|---|---|
void |
onCompleteFailure(java.lang.Throwable x)
Invoked when the overall task has completed with a failure.
|
protected IteratingCallback.Action |
process()
Method called by
IteratingCallback.iterate() to process the sub task. |
getInvocationType, onCompleteSuccess, toStringclose, failed, isClosed, isFailed, isSucceeded, iterate, reset, succeededclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInvocationType, invokeNonBlocking, isNonBlockingInvocationprivate final java.nio.channels.ReadableByteChannel _in
private final java.nio.ByteBuffer _buffer
private boolean _eof
public ReadableByteChannelWritingCB(java.nio.channels.ReadableByteChannel in,
Callback callback)
protected IteratingCallback.Action process() throws java.lang.Exception
IteratingCallbackIteratingCallback.iterate() to process the sub task.
Implementations must start the asynchronous execution of the sub task (if any) and return an appropriate action:
IteratingCallback.Action.IDLE when no sub tasks are available for execution
but the overall job is not completed yetIteratingCallback.Action.SCHEDULED when the sub task asynchronous execution
has been startedIteratingCallback.Action.SUCCEEDED when the overall job is completedprocess in class IteratingCallbackjava.lang.Exceptionpublic void onCompleteFailure(java.lang.Throwable x)
IteratingCallbackonCompleteFailure in class IteratingNestedCallbackx - the throwable to indicate cause of failureIteratingCallback.onCompleteSuccess()