ehcache

net.sf.ehcache.pool
Interface Pool<T>

Type Parameters:
T - type of store that uses this pool
All Known Implementing Classes:
AbstractPool, BoundedPool, StrictlyBoundedPool, UnboundedPool

public interface Pool<T>

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

Method Summary
 PoolAccessor<T> createPoolAccessor(T store, int maxDepth, boolean abortWhenMaxDepthExceeded)
          Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.
 PoolAccessor<T> createPoolAccessor(T store, SizeOfEngine sizeOfEngine)
          Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.
 PoolEvictor<T> getEvictor()
          Return the pool evictor used by this pool.
 long getMaxSize()
          Return the maximum size of the pool.
 Collection<T> getPoolableStores()
          Return the stores accessing this pool.
 long getSize()
          Return the used size of the pool.
 void registerPoolAccessor(PoolAccessor<? extends T> accessor)
          Register an accessor implementation with this pool.
 void removePoolAccessor(PoolAccessor<?> accessor)
          Remove the supplied accessor from this pool.
 void setMaxSize(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<T> createPoolAccessor(T store,
                                   int maxDepth,
                                   boolean abortWhenMaxDepthExceeded)
Return a PoolAccessor whose consumption is tracked by this pool, using a default SizeOf engine.

Parameters:
store - the store 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<? extends T> 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<T> createPoolAccessor(T store,
                                   SizeOfEngine sizeOfEngine)
Return a PoolAccessor whose consumption is tracked by this pool, using a specific SizeOf engine.

Parameters:
store - the store 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.

getPoolableStores

Collection<T> getPoolableStores()
Return the stores accessing this pool.

Returns:
stores using this pool

getEvictor

PoolEvictor<T> getEvictor()
Return the pool evictor used by this pool.

Returns:
the pool evictor

ehcache

Copyright © 2003-2014 Terracotta, Inc.. All Rights Reserved.