| Modifier and Type | Class and Description |
|---|---|
| public class |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBuffer[] | |
| private IoCallback | |
| private StreamSinkChannel | |
| private final HttpServerExchange | |
| private FileChannel | |
| private volatile Thread | |
| private PooledByteBuffer[] | |
| private AsyncSenderImpl. | |
| private ChannelListener | |
| private volatile Thread | writeThread
This object is not intended to be used in a multi threaded manner however as we run code after the callback it is possible that another thread may call send while we are still running we use the 'writeThread' state guard to protect against this happening. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close(final IoCallback
The callback that is notified when all data has been flushed and the channel is closed callback)Implements io. Closes this sender asynchronously. |
| public void | |
| private void | |
| private void | |
| private void | |
| public void | send(final ByteBuffer
The buffer to send. buffer, final IoCallback The callback callback)Implements io. Write the given buffer using async IO, and calls the given callback on completion or error. |
| public void | send(final ByteBuffer[]
The buffers to send. buffer, final IoCallback The callback callback)Implements io. Write the given buffers using async IO, and calls the given callback on completion or error. |
| public void | send(final ByteBuffer
The buffer to send. buffer)Implements io. Write the given buffer using async IO, and ends the exchange when done |
| public void | send(final ByteBuffer[]
The buffers to send. buffer)Implements io. Write the given buffers using async IO, and ends the exchange when done |
| public void | send(final String
The data to send data, final IoCallback The callback callback)Implements io. Write the given String using async IO, and calls the given callback on completion or error. |
| public void | send(final String
The buffer to end. data, final Charset The charset to use charset, final IoCallback The callback callback)Implements io. Write the given String using async IO, and calls the given callback on completion or error. |
| public void | send(final String
The data to send data)Implements io. Write the given String using async IO, and ends the exchange when done The CharSequence is encoded to UTF8 |
| public void | send(final String
The buffer to end. data, final Charset The charset to use charset)Implements io. Write the given String using async IO, and ends the exchange when done |
| public void | transferFrom(FileChannel
the file channel to transfer source, IoCallback The callback callback)Implements io. Transfers all content from the specified file |
| buffer | back to summary |
|---|---|
| private ByteBuffer[] buffer | |
| callback | back to summary |
|---|---|
| private IoCallback callback | |
| channel | back to summary |
|---|---|
| private StreamSinkChannel channel | |
| exchange | back to summary |
|---|---|
| private final HttpServerExchange exchange | |
| fileChannel | back to summary |
|---|---|
| private FileChannel fileChannel | |
| inCallback | back to summary |
|---|---|
| private volatile Thread inCallback | |
| pooledBuffers | back to summary |
|---|---|
| private PooledByteBuffer[] pooledBuffers | |
| transferTask | back to summary |
|---|---|
| private AsyncSenderImpl. | |
| writeListener | back to summary |
|---|---|
| private ChannelListener<StreamSinkChannel> writeListener | |
| writeThread | back to summary |
|---|---|
| private volatile Thread writeThread This object is not intended to be used in a multi threaded manner however as we run code after the callback it is possible that another thread may call send while we are still running we use the 'writeThread' state guard to protect against this happening. During a send() call the 'writeThread' object is set first, followed by the buffer. The inCallback variable is used to determine if the current thread is in the process of running a callback. After the callback has been invoked the thread that initiated the callback will only continue to process if it is the writeThread. | |
| AsyncSenderImpl | back to summary |
|---|---|
| public AsyncSenderImpl(final HttpServerExchange exchange) | |
| close | back to summary |
|---|---|
| public void close(final IoCallback callback) Implements io. Doc from io. Closes this sender asynchronously. The given callback is notified on completion
| |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from io. Closes this sender asynchronously
| |
| initWriteListener | back to summary |
|---|---|
| private void initWriteListener() | |
| invokeOnComplete | back to summary |
|---|---|
| private void invokeOnComplete() Invokes the onComplete method. If send is called again in onComplete then we loop and write it out. This prevents possible stack overflows due to recursion | |
| invokeOnException | back to summary |
|---|---|
| private void invokeOnException(IoCallback callback, IOException e) | |
| send | back to summary |
|---|---|
| public void send(final ByteBuffer buffer, final IoCallback callback) Implements io. Doc from io. Write the given buffer using async IO, and calls the given callback on completion or error.
| |
| send | back to summary |
|---|---|
| public void send(final ByteBuffer[] buffer, final IoCallback callback) Implements io. Doc from io. Write the given buffers using async IO, and calls the given callback on completion or error.
| |
| send | back to summary |
|---|---|
| public void send(final ByteBuffer buffer) Implements io. Doc from io. Write the given buffer using async IO, and ends the exchange when done
| |
| send | back to summary |
|---|---|
| public void send(final ByteBuffer[] buffer) Implements io. Doc from io. Write the given buffers using async IO, and ends the exchange when done
| |
| send | back to summary |
|---|---|
| public void send(final String data, final IoCallback callback) Implements io. Doc from io. Write the given String using async IO, and calls the given callback on completion or error. The CharSequence is encoded to UTF8
| |
| send | back to summary |
|---|---|
| public void send(final String data, final Charset charset, final IoCallback callback) Implements io. Doc from io. Write the given String using async IO, and calls the given callback on completion or error.
| |
| send | back to summary |
|---|---|
| public void send(final String data) Implements io. Doc from io. Write the given String using async IO, and ends the exchange when done The CharSequence is encoded to UTF8 | |
| send | back to summary |
|---|---|
| public void send(final String data, final Charset charset) Implements io. Doc from io. Write the given String using async IO, and ends the exchange when done | |
| transferFrom | back to summary |
|---|---|
| public void transferFrom(FileChannel source, IoCallback callback) Implements io. Doc from io. Transfers all content from the specified file
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | handleEvent(StreamSinkChannel
the channel event channel)Implements org. Handle the event on this channel. |
| public boolean | |
| public void |
| TransferTask | back to summary |
|---|---|
| public TransferTask() | |
| handleEvent | back to summary |
|---|---|
| public void handleEvent(StreamSinkChannel channel) Implements org. Doc from org. Handle the event on this channel.
| |
| run | back to summary |
|---|---|
| public boolean run(boolean complete) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |