Class CleanerJava25

  • All Implemented Interfaces:
    Cleaner

    final class CleanerJava25
    extends java.lang.Object
    implements Cleaner
    Provide a way to clean direct ByteBuffer instances on Java 24+, where we don't have Unsafe available, but we have memory segments.

    The FFM API is compiled against the netty-ffm-stub module, and only used from the nested CleanerJava25.Arenas class, which is only loaded on Java versions that have the FFM API.

    • Field Detail

      • SUPPORTED

        private static final boolean SUPPORTED
    • Constructor Detail

      • CleanerJava25

        CleanerJava25()
    • Method Detail

      • isSupported

        static boolean isSupported()
      • freeDirectBuffer

        public void freeDirectBuffer​(java.nio.ByteBuffer buffer)
        Description copied from interface: Cleaner
        Free a direct ByteBuffer if possible
        Specified by:
        freeDirectBuffer in interface Cleaner
      • hasExpensiveClean

        public boolean hasExpensiveClean()
        Description copied from interface: Cleaner
        Check if the clean operation is "relatively expensive". Expensive clean operations are fine for pooling allocators, but should be avoided for unpooled buffers.
        Specified by:
        hasExpensiveClean in interface Cleaner
        Returns:
        true if this Cleaner has an expensive clean (i.e. CleanableDirectBuffer.clean()) operation.