Package org.jgrapes.io.util
Interface BufferCollector<B extends ManagedBuffer<?>>
- Type Parameters:
B
- the type of buffer that can be collected
- All Known Implementing Classes:
ManagedBufferPool
public interface BufferCollector<B extends ManagedBuffer<?>>
Defines the method of a buffer collector.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BufferCollector
<? extends ManagedBuffer<?>> A predefined buffer collector that does nothing when the managed buffer is no longer used. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ManagedBuffer<?>>
BufferCollector<T> A type-safe way to get theNOOP_COLLECTOR
.void
Recollect the buffer.
-
Field Details
-
NOOP_COLLECTOR
A predefined buffer collector that does nothing when the managed buffer is no longer used.Using this collector with a managed buffer effectively make it an unmanaged buffer.
-
-
Method Details
-
noopCollector
A type-safe way to get theNOOP_COLLECTOR
.- Type Parameters:
T
- the type of buffer that can be collected- Returns:
- the noop buffer collector
-
recollect
Recollect the buffer.Invoked after all locks to a managed buffer have been released. Usually, the implementation of a buffer collector returns the buffer into some kind of pool when this method is invoked.
- Parameters:
buffer
- the buffer
-