Package net.sf.ehcache.pool
Interface Pool
-
- All Known Implementing Classes:
AbstractPool,BoundedPool,StrictlyBoundedPool,UnboundedPool
public interface PoolPools 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PoolAccessorcreatePoolAccessor(PoolParticipant participant, int maxDepth, boolean abortWhenMaxDepthExceeded)Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.PoolAccessorcreatePoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine)Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.PoolEvictorgetEvictor()Return the pool evictor used by this pool.longgetMaxSize()Return the maximum size of the pool.java.util.Collection<PoolAccessor>getPoolAccessors()Return the participants accessing this pool.longgetSize()Return the used size of the pool.voidregisterPoolAccessor(PoolAccessor accessor)Register an accessor implementation with this pool.voidremovePoolAccessor(PoolAccessor accessor)Remove the supplied accessor from this pool.voidsetMaxSize(long newSize)Change the maximum size of the pool.
-
-
-
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 traverseabortWhenMaxDepthExceeded- 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
-
-