public interface ByteBufferCleanerService
This interface defines a contract for cleaning memory resources associated with ByteBuffers. It can be implemented by different service providers offering different mechanisms for resource cleanup.
Cleaning a ByteBuffer usually means releasing the direct memory that is typically limited and more expensive than regular heap memory. This operation can be critical in environments where lots of direct ByteBuffers are being used, like in high-performance IO or memory-mapped files.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ByteBufferCleanerService.Impact
Enum representing the various impact levels of the cleaning operation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clean(ByteBuffer buffer)
Performs cleaning operation on the specified ByteBuffer.
|
ByteBufferCleanerService.Impact |
impact()
Indicates the impact level of cleaning operation.
|
ByteBufferCleanerService.Impact impact()
ByteBufferCleanerService.Impact of the cleaning operation on performance or resource availability.void clean(ByteBuffer buffer)
If the buffer is a direct ByteBuffer, this operation is expected to release
any memory resources associated with it. Depending on the implementation, this method
may have side effects or performance impacts, which can be queried via the impact() method.
buffer - the ByteBuffer to clean.Copyright © 2024. All rights reserved.