Package io.netty.util.internal
Class CleanerJava24Linker
- java.lang.Object
-
- io.netty.util.internal.CleanerJava24Linker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCleanerJava24Linker.CleanableDirectBufferImpl
-
Field Summary
Fields Modifier and Type Field Description private static MethodHandleINVOKE_CREATE_BYTEBUFFERprivate static MethodHandleINVOKE_FREEprivate static MethodHandleINVOKE_MALLOCprivate static InternalLoggerlogger
-
Constructor Summary
Constructors Constructor Description CleanerJava24Linker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CleanableDirectBufferallocate(int capacity)Create a directByteBufferand return it alongside its cleaning mechanism, in aCleanableDirectBuffer.(package private) static voidfree(long memoryAddress)voidfreeDirectBuffer(java.nio.ByteBuffer buffer)Free a directByteBufferif possiblebooleanhasExpensiveClean()Check if the clean operation is "relatively expensive".(package private) static booleanisSupported()(package private) static longmalloc(int capacity)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.util.internal.Cleaner
reallocate
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
INVOKE_MALLOC
private static final MethodHandle INVOKE_MALLOC
-
INVOKE_CREATE_BYTEBUFFER
private static final MethodHandle INVOKE_CREATE_BYTEBUFFER
-
INVOKE_FREE
private static final MethodHandle INVOKE_FREE
-
-
Method Detail
-
isSupported
static boolean isSupported()
-
allocate
public CleanableDirectBuffer allocate(int capacity)
Description copied from interface:CleanerCreate a directByteBufferand return it alongside its cleaning mechanism, in aCleanableDirectBuffer.- Specified by:
allocatein interfaceCleaner- Parameters:
capacity- The desired capacity of the direct buffer.- Returns:
- The new
CleanableDirectBufferinstance.
-
freeDirectBuffer
public void freeDirectBuffer(java.nio.ByteBuffer buffer)
Description copied from interface:CleanerFree a directByteBufferif possible- Specified by:
freeDirectBufferin interfaceCleaner
-
hasExpensiveClean
public boolean hasExpensiveClean()
Description copied from interface:CleanerCheck if the clean operation is "relatively expensive". Expensive clean operations are fine for pooling allocators, but should be avoided for unpooled buffers.- Specified by:
hasExpensiveCleanin interfaceCleaner- Returns:
trueif this Cleaner has an expensive clean (i.e.CleanableDirectBuffer.clean()) operation.
-
malloc
static long malloc(int capacity)
-
free
static void free(long memoryAddress)
-
-