Class NettyNioBufferReleasingAllocator
java.lang.Object
eu.cloudnetservice.driver.network.netty.buffer.NettyNioBufferReleasingAllocator
- All Implemented Interfaces:
io.netty5.buffer.AllocatorControl,io.netty5.buffer.BufferAllocator,io.netty5.util.SafeCloseable,AutoCloseable
@Internal
public final class NettyNioBufferReleasingAllocator
extends Object
implements io.netty5.buffer.BufferAllocator, io.netty5.buffer.AllocatorControl
A buffer allocator that is allocating nio buffers and frees them directly when they are closed.
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordA drop implementation that ínvokes the cleaner of ByteBuffers directly upon dropping. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new buffer allocator instance. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty5.buffer.BufferAllocator
compose, compose, compose, copyOf, copyOf, copyOf
-
Field Details
-
manager
private final io.netty5.buffer.bytebuffer.ByteBufferMemoryManager manager -
closed
private volatile boolean closed
-
-
Constructor Details
-
NettyNioBufferReleasingAllocator
public NettyNioBufferReleasingAllocator()Constructs a new buffer allocator instance. All instances are backed by a byte buffer memory manager.
-
-
Method Details
-
notAbleToFreeBuffers
public static boolean notAbleToFreeBuffers()Get if this allocator can free direct buffers. If this method returns false, this allocator shouldn't be used as it does nothing. Use the default netty allocator instead.- Returns:
- if this allocator is able to free direct nio buffers.
-
getAllocationType
-
allocate
-
constBufferSupplier
-
getAllocator
-
isPooling
public boolean isPooling()- Specified by:
isPoolingin interfaceio.netty5.buffer.BufferAllocator
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.netty5.buffer.BufferAllocator- Specified by:
closein interfaceio.netty5.util.SafeCloseable
-