Class UnboundedPool

  • All Implemented Interfaces:
    Pool

    public class UnboundedPool
    extends java.lang.Object
    implements Pool
    A no-op pool which does not enforce any resource consumption limit.
    Author:
    Ludovic Orban, Alex Snaps
    • Constructor Detail

      • UnboundedPool

        public UnboundedPool()
        Create an UnboundedPool instance
    • Method Detail

      • getSize

        public long getSize()
        Return the used size of the pool.
        Specified by:
        getSize in interface Pool
        Returns:
        used size of the pool.
      • getMaxSize

        public long getMaxSize()
        Return the maximum size of the pool.
        Specified by:
        getMaxSize in interface Pool
        Returns:
        the maximum size of the pool.
      • setMaxSize

        public void setMaxSize​(long newSize)
        Change the maximum size of the pool.
        Specified by:
        setMaxSize in interface Pool
        Parameters:
        newSize - the new pool size.
      • createPoolAccessor

        public PoolAccessor createPoolAccessor​(PoolParticipant participant,
                                               int maxDepth,
                                               boolean abortWhenMaxDepthExceeded)
        Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.
        Specified by:
        createPoolAccessor in interface Pool
        Parameters:
        participant - the participant which will use the created accessor.
        maxDepth - maximum depth of the object graph to traverse
        abortWhenMaxDepthExceeded - true if the object traversal should be aborted when the max depth is exceeded
        Returns:
        a PoolAccessor whose consumption is tracked by this pool.
      • createPoolAccessor

        public PoolAccessor createPoolAccessor​(PoolParticipant participant,
                                               SizeOfEngine sizeOfEngine)
        Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.
        Specified by:
        createPoolAccessor in interface Pool
        Parameters:
        participant - the participant which will use the created accessor.
        sizeOfEngine - the SizeOf engine used to measure the size of objects added through the created accessor.
        Returns:
        a PoolAccessor whose consumption is tracked by this pool.
      • registerPoolAccessor

        public void registerPoolAccessor​(PoolAccessor accessor)
        Register an accessor implementation with this pool.
        Specified by:
        registerPoolAccessor in interface Pool
        Parameters:
        accessor - accessor to be registered
      • removePoolAccessor

        public void removePoolAccessor​(PoolAccessor accessor)
        Remove the supplied accessor from this pool.
        Specified by:
        removePoolAccessor in interface Pool
        Parameters:
        accessor - accessor to be removed
      • getPoolAccessors

        public java.util.Collection<PoolAccessor> getPoolAccessors()
        Return the participants accessing this pool.
        Specified by:
        getPoolAccessors in interface Pool
        Returns:
        participants using this pool
      • getEvictor

        public PoolEvictor getEvictor()
        Return the pool evictor used by this pool.
        Specified by:
        getEvictor in interface Pool
        Returns:
        the pool evictor