Package io.netty5.buffer.api
Class DefaultBufferAllocators
- java.lang.Object
-
- io.netty5.buffer.api.DefaultBufferAllocators
-
public final class DefaultBufferAllocators extends Object
Accessor for the default, sharedBufferAllocator
instances. Two allocators are provided; one on-heap allocator, and one off-heap allocator.These default allocators are configured via system properties.
These allocators cannot be closed directly. They will instead be disposed of when the
Runtime
is shutdown.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferAllocator
offHeapAllocator()
Get the shared off-heap allocator.static BufferAllocator
onHeapAllocator()
Get the shared on-heap allocator.static BufferAllocator
preferredAllocator()
Get the preferred, shared allocator.
-
-
-
Method Detail
-
preferredAllocator
public static BufferAllocator preferredAllocator()
Get the preferred, shared allocator. This allocator is either on- or off-heap, and either pooling or unpooled, depending on the global configuration.- Returns:
- The shared, generally preferred allocator.
-
onHeapAllocator
public static BufferAllocator onHeapAllocator()
Get the shared on-heap allocator. This allocator always allocates on-heap buffers, and is either pooled, or unpooled.- Returns:
- The shared on-heap allocator.
-
offHeapAllocator
public static BufferAllocator offHeapAllocator()
Get the shared off-heap allocator. This allocator always allocates off-heap buffers, and is either pooled, or unpooled.- Returns:
- The shared off-heap allocator.
-
-