Class DirectByteBufferPool$


  • public class DirectByteBufferPool$
    extends java.lang.Object
    INTERNAL API
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static DirectByteBufferPool$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void tryCleanDirectByteBuffer​(java.nio.ByteBuffer byteBuffer)
      DirectByteBuffers are garbage collected by using a phantom reference and a reference queue.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final DirectByteBufferPool$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • DirectByteBufferPool$

        public DirectByteBufferPool$()
    • Method Detail

      • tryCleanDirectByteBuffer

        public void tryCleanDirectByteBuffer​(java.nio.ByteBuffer byteBuffer)
        DirectByteBuffers are garbage collected by using a phantom reference and a reference queue. Every once a while, the JVM checks the reference queue and cleans the DirectByteBuffers. However, as this doesn't happen immediately after discarding all references to a DirectByteBuffer, it's easy to OutOfMemoryError yourself using DirectByteBuffers. This function explicitly calls the Cleaner method of a DirectByteBuffer.

        Utilizes reflection to avoid dependency to sun.misc.Cleaner.