Interface Pool

  • All Known Implementing Classes:
    AbstractPool, BoundedPool, StrictlyBoundedPool, UnboundedPool

    public interface Pool
    Pools are used to track shared resource consumption. Each store participating in a pool creates an accessor which it uses to tell the pool about its consumption. A SizeOf engine is used to calculate the size of the objects added to the pool.
    Author:
    Ludovic Orban, Alex Snaps
    • Method Detail

      • getSize

        long getSize()
        Return the used size of the pool.
        Returns:
        used size of the pool.
      • getMaxSize

        long getMaxSize()
        Return the maximum size of the pool.
        Returns:
        the maximum size of the pool.
      • setMaxSize

        void setMaxSize​(long newSize)
        Change the maximum size of the pool.
        Parameters:
        newSize - the new pool size.
      • createPoolAccessor

        PoolAccessor createPoolAccessor​(PoolParticipant participant,
                                        int maxDepth,
                                        boolean abortWhenMaxDepthExceeded)
        Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.
        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.
      • registerPoolAccessor

        void registerPoolAccessor​(PoolAccessor accessor)
        Register an accessor implementation with this pool.
        Parameters:
        accessor - accessor to be registered
      • removePoolAccessor

        void removePoolAccessor​(PoolAccessor accessor)
        Remove the supplied accessor from this pool.
        Parameters:
        accessor - accessor to be removed
      • createPoolAccessor

        PoolAccessor createPoolAccessor​(PoolParticipant participant,
                                        SizeOfEngine sizeOfEngine)
        Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.
        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.
      • getPoolAccessors

        java.util.Collection<PoolAccessor> getPoolAccessors()
        Return the participants accessing this pool.
        Returns:
        participants using this pool
      • getEvictor

        PoolEvictor getEvictor()
        Return the pool evictor used by this pool.
        Returns:
        the pool evictor