Clarify what it means to close a BufferAllocator

This commit is contained in:
Chris Vest 2021-05-03 17:06:05 +02:00
parent 928f0bbb14
commit 44c476c461

View File

@ -98,8 +98,17 @@ public interface BufferAllocator extends AutoCloseable {
} }
/** /**
* Close this allocator, freeing all of its internal resources. It is not specified if the allocator can still be * Close this allocator, freeing all of its internal resources.
* used after this method has been called on it. * <p>
* Existing (currently in-use) allocated buffers will not be impacted by calling this method.
* If this is a pooling or caching allocator, then existing buffers will be immediately freed when they are closed,
* instead of being pooled or cached.
* <p>
* The allocator can still be used to allocate more buffers after calling this method.
* However, if this is a pooling or caching allocator, then the pooling and caching functionality will be
* effectively disabled after calling this method.
* <p>
* If this allocator does not perform any pooling or caching, then calling this method likely has no effect.
*/ */
@Override @Override
default void close() { default void close() {