Interface Cleaner

    • Method Detail

      • reallocate

        default CleanableDirectBuffer reallocate​(CleanableDirectBuffer old,
                                                 int newCapacity)
        Reallocate a direct buffer with a new capacity. The old buffer is consumed and must not be used after this call.

        The default implementation allocates a new buffer, copies the data, and frees the old one. Implementations may override this to provide more efficient reallocation (e.g. via Unsafe.reallocateMemory).

      • freeDirectBuffer

        @Deprecated
        void freeDirectBuffer​(java.nio.ByteBuffer buffer)
        Deprecated.
        Instead allocate buffers from allocate(int) and use the associated CleanableDirectBuffer.clean() method.
        Free a direct ByteBuffer if possible
      • hasExpensiveClean

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