Class AbstractMemoryManager<E extends Buffer>

    • Field Detail

      • DEFAULT_MAX_BUFFER_SIZE

        public static final int DEFAULT_MAX_BUFFER_SIZE
        The maximum size of the memory pool that is to be maintained by either the MemoryManager itself or any ThreadLocalPools.
        See Also:
        Constant Field Values
      • maxBufferSize

        protected final int maxBufferSize
    • Constructor Detail

      • AbstractMemoryManager

        public AbstractMemoryManager()
        Creates a new AbstractMemoryManager using a max buffer size of 65536.
      • AbstractMemoryManager

        public AbstractMemoryManager​(int maxBufferSize)
        Creates a new AbstractMemoryManager using the specified buffer size.
        Parameters:
        maxBufferSize - max size of the maintained buffer.
    • Method Detail

      • getReadyThreadBufferSize

        public int getReadyThreadBufferSize()
        Get the size of local thread memory pool.
        Returns:
        the size of local thread memory pool.
      • getMaxBufferSize

        public int getMaxBufferSize()
        Returns:
        the max size of the buffer maintained by this AbstractMemoryManager.
      • allocateFromPool

        protected Object allocateFromPool​(ThreadLocalPool threadLocalCache,
                                          int size)
        Allocate a Buffer using the provided ThreadLocalPool.
        Parameters:
        threadLocalCache - the ThreadLocalPool to allocate from.
        size - the amount to allocate.
        Returns:
        an memory buffer, or null if the requested size exceeds the remaining free memory of the ThreadLocalPool.
      • createJmxManagementObject

        protected abstract Object createJmxManagementObject()
        Returns:
        the JMX Object used to register/deregister with the JMX runtime.
      • getThreadLocalPool

        protected static ThreadLocalPool getThreadLocalPool()
        Get thread associated buffer pool.
        Returns:
        thread associated buffer pool. This method may return null if the current thread doesn't have a buffer pool associated with it.