|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.perseus.cache.replacement.lib.AbstractReplacementManager
This class is a common implementation of a ReplacementManager.
FIFOReplacementManager, LRUReplacementManager, MRUReplacementManager
Field Summary | |
protected java.util.SortedSet |
entries
Sorted list of WeakReplaceableCacheEntry entries. |
protected Logger |
logger
|
protected java.util.HashMap |
oid2wentry
|
protected java.lang.ref.ReferenceQueue |
queue
Queue used to register the weak references stored in the entries list. |
protected UnbindManager |
ub
|
static java.lang.String |
UNBIND_MANAGER_BINDING
|
Constructor Summary | |
AbstractReplacementManager()
|
Method Summary | |
protected abstract void |
add(ReplaceableCacheEntry entry)
|
void |
addForReplacement(FixableCacheEntry entry)
|
void |
adjustForReplacement(FixableCacheEntry entry)
Called whenever an object has been accessed. |
void |
bindFc(java.lang.String s,
java.lang.Object o)
|
void |
cacheResized(CacheCapacityEvent event)
The cache has been resized. |
int |
forceFree(int capacity)
It forces the replacement manager to free CacheEntry instances from the cahce. |
java.lang.String[] |
listFc()
|
java.lang.Object |
lookupFc(java.lang.String s)
|
void |
removeForReplacement(java.lang.Object oid)
This method is called by the CacheManager in order to signal that an entry has been really evicted. |
protected abstract void |
touch(ReplaceableCacheEntry entry)
|
java.util.Collection |
unbind(CacheEntryFilter filter,
boolean force)
Evicts the entries which are accepted by the filter. |
boolean |
unbind(java.lang.Object oid,
boolean force)
It forces the replacement manager to unbind a CacheEntry instance from the cache. |
java.util.Collection |
unbindAll(java.util.Collection _oids,
boolean force)
Evicts instances from the cache. |
void |
unbindFc(java.lang.String s)
|
java.util.Collection |
unbindUnfixed(boolean force)
Try to evict unfixed instances. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String UNBIND_MANAGER_BINDING
protected UnbindManager ub
protected java.util.SortedSet entries
protected java.util.HashMap oid2wentry
protected java.lang.ref.ReferenceQueue queue
protected Logger logger
Constructor Detail |
public AbstractReplacementManager()
Method Detail |
public java.lang.String[] listFc()
public java.lang.Object lookupFc(java.lang.String s)
public void bindFc(java.lang.String s, java.lang.Object o)
public void unbindFc(java.lang.String s)
public void cacheResized(CacheCapacityEvent event)
CacheCapacityEventListener
cacheResized
in interface CacheCapacityEventListener
event
- contains the old and the new cache size.public void addForReplacement(FixableCacheEntry entry) throws CacheException
addForReplacement
in interface ReplacementManager
entry
- The cache entry that has been accessed.
CacheException
- Whenever an internal error occurs.public void adjustForReplacement(FixableCacheEntry entry) throws CacheException
ReplacementManager
adjustForReplacement
in interface ReplacementManager
entry
- The cache entry that has been accessed.
CacheException
- Whenever an internal error occurs.public int forceFree(int capacity) throws CacheException
ReplacementManager
forceFree
in interface ReplacementManager
capacity
- is the quantity of space required by the cache.
CacheException
public void removeForReplacement(java.lang.Object oid)
ReplacementManager
removeForReplacement
in interface ReplacementManager
oid
- is the evicted cache entrypublic java.util.Collection unbind(CacheEntryFilter filter, boolean force) throws CacheException
UnbindManager
unbind
in interface UnbindManager
filter
- is a cacheentry filter indicating wich entry has to be
evictedforce
- is a boolean value indicating if the cache must remove the
entries or let the GC does its job.
CacheException
public java.util.Collection unbindAll(java.util.Collection _oids, boolean force) throws CacheException
UnbindManager
unbindAll
in interface UnbindManager
_oids
- is a collection of the identifier associated to cache entries
to evictforce
- is a boolean value indicating if the cache must remove the
entries or let the GC does its job.
CacheException
- is raised when entries are already unbound from
the cache.public java.util.Collection unbindUnfixed(boolean force) throws CacheException
UnbindManager
unbindUnfixed
in interface UnbindManager
force
- is a boolean value indicating if the cache must remove the
entries or let the GC does its job.
CacheException
public boolean unbind(java.lang.Object oid, boolean force) throws CacheException
unbind
in interface UnbindManager
oid
- is the identifier associated to the cache entry to evictforce
- is a boolean value indicating if the cache must remove the
entry or let the GC does its job.
CacheException
- is raised when the entry is already unbound from
the cache.protected abstract void add(ReplaceableCacheEntry entry)
protected abstract void touch(ReplaceableCacheEntry entry)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |