Interface DirectMemUtil


  • public interface DirectMemUtil
    Utility methods to work with direct (off-heap) memory
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static java.nio.MappedByteBuffer getThreadLocalReusableBuff​(long size)
      Selects the thread local direct byte buffer fitting the requested buffer size.
    • Field Detail

      • REUSABLE_BUFFS

        static final java.lang.ThreadLocal<java.nio.MappedByteBuffer[]> REUSABLE_BUFFS
    • Method Detail

      • getThreadLocalReusableBuff

        static java.nio.MappedByteBuffer getThreadLocalReusableBuff​(long size)
                                                             throws java.lang.IllegalArgumentException
        Selects the thread local direct byte buffer fitting the requested buffer size. Useful for I/O.
        Parameters:
        size - the requested buffer size
        Returns:
        the buffer which size may be in the range of REUSABLE_BUFF_SIZE_MIN and REUSABLE_BUFF_SIZE_MAX
        Throws:
        java.lang.IllegalArgumentException - if the requested size is less than 0