|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ehcache.pool.impl.AbstractPoolAccessor
public abstract class AbstractPoolAccessor
Abstract PoolAccessor implementation providing pool to store binding functionality.
Field Summary | |
---|---|
protected SizeOfEngine |
sizeOfEngine
SizeOfEngine used by the accessor. |
Constructor Summary | |
---|---|
AbstractPoolAccessor(Pool pool,
PoolParticipant participant,
SizeOfEngine sizeOfEngine)
Creates an accessor for the specified participant to access the specified pool. |
Method Summary | |
---|---|
protected abstract long |
add(long sizeOf,
boolean force)
Add a specific number of bytes to the pool. |
long |
add(Object key,
Object value,
Object container,
boolean force)
Add an element to the pool. |
protected abstract boolean |
canAddWithoutEvicting(long sizeOf)
Check if there is enough room in the pool to add a specific number of bytes without provoking any eviction |
boolean |
canAddWithoutEvicting(Object key,
Object value,
Object container)
Check if there is enough room in the pool to add an element without provoking any eviction |
protected void |
checkLinked()
Throws IllegalStateException if this accessor is not linked to it's pool. |
void |
clear()
Free resources used by this accessor. |
protected abstract void |
doClear()
Free resources used by this accessor. |
PoolParticipant |
getParticipant()
Return the store that uses this accessor |
protected Pool |
getPool()
Return the pool this accessor is associated with. |
long |
getPoolOccupancy()
Returns the occupied size for this pool. |
long |
getPoolSize()
Returns the size of this pool. |
boolean |
hasAbortedSizeOf()
Check if the store may contain elements which the SizeOf engine could not fully size. |
long |
replace(long currentSize,
Object key,
Object value,
Object container,
boolean force)
Delete a fixed number of bytes from the pool with the given objects. |
void |
setMaxSize(long newValue)
Sets the max size for this pool |
void |
unlink()
unlink this PoolAccessor from its pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.ehcache.pool.PoolAccessor |
---|
delete, getSize |
Field Detail |
---|
protected final SizeOfEngine sizeOfEngine
SizeOfEngine
used by the accessor.
Constructor Detail |
---|
public AbstractPoolAccessor(Pool pool, PoolParticipant participant, SizeOfEngine sizeOfEngine)
pool
- pool to be accessedparticipant
- accessing participantMethod Detail |
---|
public final long add(Object key, Object value, Object container, boolean force)
add
in interface PoolAccessor<PoolParticipant>
key
- the key of the elementvalue
- the value of the elementcontainer
- the element-container objectforce
- true if the pool should accept adding the element, even if it's out of resources
public final boolean canAddWithoutEvicting(Object key, Object value, Object container)
canAddWithoutEvicting
in interface PoolAccessor<PoolParticipant>
key
- the key of the elementvalue
- the value of the elementcontainer
- the element-container object
protected abstract long add(long sizeOf, boolean force) throws IllegalArgumentException
sizeOf
- number of bytes to addforce
- true if the pool should accept adding the element, even if it's out of resources
IllegalArgumentException
- when sizeOf is negativeprotected abstract boolean canAddWithoutEvicting(long sizeOf)
sizeOf
- number of bytes to test against
public final long replace(long currentSize, Object key, Object value, Object container, boolean force)
replace
in interface PoolAccessor<PoolParticipant>
currentSize
- the size of the object(s) being replacedkey
- the key of the elementvalue
- the value of the elementcontainer
- the element-container objectforce
- true if the pool should accept replacing the element, even if it's out of resources
Long.MIN_VALUE
if replace failed.public final void clear()
clear
in interface PoolAccessor<PoolParticipant>
protected abstract void doClear()
clear()
.
public final void unlink()
unlink
in interface PoolAccessor<PoolParticipant>
public final PoolParticipant getParticipant()
getParticipant
in interface PoolAccessor<PoolParticipant>
public void setMaxSize(long newValue)
setMaxSize
in interface PoolAccessor<PoolParticipant>
newValue
- the value in bytespublic long getPoolOccupancy()
getPoolOccupancy
in interface PoolAccessor<PoolParticipant>
public long getPoolSize()
getPoolSize
in interface PoolAccessor<PoolParticipant>
protected final void checkLinked() throws IllegalStateException
IllegalStateException
if this accessor is not linked to it's pool.
IllegalStateException
- if not linkedprotected final Pool getPool()
public boolean hasAbortedSizeOf()
hasAbortedSizeOf
in interface PoolAccessor<PoolParticipant>
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |