Interface BufferListener
-
- All Known Implementing Classes:
BufferManager
public interface BufferListener
Interface of the availability of buffers. Listeners can opt for a one-time only notification or to be notified repeatedly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
notifyBufferAvailable(Buffer buffer)
Notification callback if a buffer is recycled and becomes available in buffer pool.void
notifyBufferDestroyed()
Notification callback if the buffer provider is destroyed.
-
-
-
Method Detail
-
notifyBufferAvailable
boolean notifyBufferAvailable(Buffer buffer)
Notification callback if a buffer is recycled and becomes available in buffer pool.Note: 1) Responsibility on recycling the given buffer is transferred to this implementation, including any errors that lead to exceptions being thrown! 2) The listener must register itself again if it needs still need more buffers.
BEWARE: since this may be called from outside the thread that relies on the listener's logic, any exception that occurs with this handler should be forwarded to the responsible thread for handling and otherwise ignored in the processing of this method. The buffer pool forwards any
Throwable
from here upwards to a potentially unrelated call stack!- Parameters:
buffer
- buffer that becomes available in buffer pool.- Returns:
- true if the buffer is accepted by the listener.
-
notifyBufferDestroyed
void notifyBufferDestroyed()
Notification callback if the buffer provider is destroyed.
-
-