public interface BufferProvider
| Modifier and Type | Interface and Description |
|---|---|
static class |
BufferProvider.BufferAvailabilityRegistration |
| Modifier and Type | Method and Description |
|---|---|
int |
getBufferSize()
Returns the size of buffers (in bytes) available at this buffer provider.
|
BufferProvider.BufferAvailabilityRegistration |
registerBufferAvailabilityListener(BufferAvailabilityListener listener)
Registers the given
BufferAvailabilityListener with an empty buffer pool. |
void |
reportAsynchronousEvent()
Reports an asynchronous event and interrupts each blocking method of this buffer provider in order to allow the
blocked thread to respond to the event.
|
Buffer |
requestBuffer(int minBufferSize)
Requests a buffer with a minimum size of
minBufferSize. |
Buffer |
requestBufferBlocking(int minBufferSize)
Requests a buffer with a minimum size of
minBufferSize. |
Buffer requestBuffer(int minBufferSize) throws IOException
minBufferSize. The method returns immediately, even if the
request could not be fulfilled.minBufferSize - minimum size of the requested buffer (in bytes)null if no such buffer is currently availableIOExceptionBuffer requestBufferBlocking(int minBufferSize) throws IOException, InterruptedException
minBufferSize. The method blocks until the request has
been fulfilled or reportAsynchronousEvent() has been called.minBufferSize - minimum size of the requested buffer (in bytes)IOExceptionInterruptedExceptionint getBufferSize()
void reportAsynchronousEvent()
BufferProvider.BufferAvailabilityRegistration registerBufferAvailabilityListener(BufferAvailabilityListener listener)
BufferAvailabilityListener with an empty buffer pool.
The registration only succeeds, if the buffer pool is empty and has not been destroyed yet.
The registered listener will receive a notification when at least one buffer has become available again. After the notification, the listener will be unregistered.
listener - the listener to be registeredtrue if the registration has been successful; false if the registration
failed, because the buffer pool was not empty or has already been destroyedCopyright © 2015 The Apache Software Foundation. All rights reserved.