Class DirectBufferManager

    • Field Detail

      • CLEANUP_NONE

        public static final int CLEANUP_NONE
        Deprecated.
        Do not perform any buffer cleanup.
        See Also:
        Constant Field Values
      • CLEANUP_FINALIZERS

        public static final int CLEANUP_FINALIZERS
        Deprecated.
        Use Runtime.runFinalization() to trigger finalization (default).
        See Also:
        Constant Field Values
      • CLEANUP_GC

        public static final int CLEANUP_GC
        Deprecated.
        Use Runtime.gc() to trigger finalization.
        See Also:
        Constant Field Values
      • MODE_DEBUG

        protected static final boolean MODE_DEBUG
        Deprecated.
        Set to true to use on-heap storage, false to use off-heap.
        See Also:
        Constant Field Values
      • s_cbUncollected

        protected static volatile long s_cbUncollected
        Deprecated.
        Total amount of memory that have not been collected yet.
    • Constructor Detail

      • DirectBufferManager

        public DirectBufferManager​(int cbInitial,
                                   int cbMaximum)
        Deprecated.
        Construct a DirectBufferManager that supports a buffer of a certain initial and maximum size.
        Parameters:
        cbInitial - the initial size
        cbMaximum - the maximum size
    • Method Detail

      • cleanupBuffers

        protected void cleanupBuffers()
        Deprecated.
        Determines if and how to induce the JVM to run finalizers. This allows to somewhat mitigate a known JDK bug.

        When the amount of uncollected garbage reaches the threshold indicated by the cleanup threshold frequency, induce the GC. In a 64-bit VMs this issue is probably reduced to a minimum.

      • getTotalAllocationTime

        public static long getTotalAllocationTime()
        Deprecated.
        Return the total time spent allocating buffers, copying the previous content and cleaning up uncollected buffers.
        Returns:
        the number of milliseconds spent in allocating, copying and cleaning up uncollected buffers
      • getAllocations

        public static int getAllocations()
        Deprecated.
        Return the total number of buffers allocated by the DirectBufferManager.
        Returns:
        the total number of allocations
      • getCleanupMethod

        public static int getCleanupMethod()
        Deprecated.
        Return the method used for buffers cleanup when the threshold is met.

        The possible return values are:

        • CLEANUP_FINALIZERS - use Runtime.runFinalization() (default);
        • CLEANUP_GC - use Runtime.gc();
        • CLEANUP_NONE - do not perform any cleanup.

        Returns:
        one of the CLEANUP_* constants representing the cleanup method
      • setCleanupMethod

        protected static void setCleanupMethod​(int nCleanupMethod)
        Deprecated.
        Set the method to be used for buffers cleanup when the threshold is met.
        Parameters:
        nCleanupMethod - a value representing the cleanup method; valid values are the CLEANUP_* constants
        Throws:
        IllegalArgumentException - if passed value is not a valid CLEANUP_* constant
      • getCleanupThreshold

        public static float getCleanupThreshold()
        Deprecated.
        Return the value used to calculate the size threshold for the uncollected buffers that triggers a cleanup operation. Cleanup is performed when the total size of uncollected memory has grown over the product of this value and the maximum Java heap size.
        Returns:
        a value between 0.0 and 1.0 used to calculate the cleanup frequency
      • setCleanupThreshold

        protected static void setCleanupThreshold​(float flCleanupThreshold)
        Deprecated.
        Determines how often, to run the cleanupBuffers() method. Cleanup is performed when the uncollected memory has grown over the product of this value and the maximum Java heap size.
        Parameters:
        flCleanupThreshold - a value between 0.0 and 1.0 used to calculate the cleanup frequency
        Throws:
        IllegalArgumentException - if the passed value is not valid