This class is an implementation of a cache. The data structure is a Hahsed
map between cache entry identifier and an entry instance.
This class is a fractal component.
CACHE_CAPACTITY_LISTENER_BINDING
public static final String CACHE_CAPACTITY_LISTENER_BINDING
CACHE_ENTRY_FACTORY_BINDING
public static final String CACHE_ENTRY_FACTORY_BINDING
CACHE_LISTENER_BINDING
public static final String CACHE_LISTENER_BINDING
DEFAULT_AUTO_CLEAN_SIZE
public static final String DEFAULT_AUTO_CLEAN_SIZE
REPLACEMENT_MANAGER_BINDING
public static final String REPLACEMENT_MANAGER_BINDING
bgclogger
protected Logger bgclogger
cache
protected Map cache
This field is the cache. This is a Map which the key are object
identifiers and the values are FixableCacheEntry instances.
cacheMaxSize
protected int cacheMaxSize
This field is the max size of the cache.
cacheThresHold
protected int cacheThresHold
cacheThresHoldStr
protected String cacheThresHoldStr
ccels
protected HashMap ccels
This field is the list of CacheEventListener registered.
cef
protected CacheEntryFactory cef
This field is the factory of CacheEntry instances.
cels
protected HashMap cels
This field is the list of CacheEventListener registered.
logger
protected Logger logger
queue
protected ReferenceQueue queue
Queue used to register the weak references stored in the cache.
bindFc
public void bindFc(String s,
Object o)
getCurrentMemorySize
public int getCurrentMemorySize()
- getCurrentMemorySize in interface CacheAttributeController
- an positive integer value. It is the current size of the cache
in octets. This size matches to the memory foot print of the entries set
managed by the cache.
getCurrentSize
public int getCurrentSize()
- getCurrentSize in interface CacheAttributeController
- an positive integer value. It is the current size of the cache
in term of object number currently managed by the cache.
getFcState
public String getFcState()
listFc
public String[] listFc()
lookupFc
public Object lookupFc(String s)
setAutoCleanSize
public void setAutoCleanSize(String size)
Assignes the number of element which can be removed when the cache is
full. This value can be an absolute value( ex: "124") or a percent of the
maximal cache size ("8%").
- setAutoCleanSize in interface CacheAttributeController
setAutoCleanThreshold
public void setAutoCleanThreshold(String size)
Assignes the cache size value since the cache try to decrease the number
of entries. This value can be an absolute value( ex: "124") or a percent
of the maximal cache size ("8%").
- setAutoCleanThreshold in interface CacheAttributeController
setMaxObjects
public void setMaxObjects(int size)
throws IllegalArgumentException,
CacheException
This method allows to set the maximum number of objects to be
held by the cache manager. However, the actual capacity of
the cache depends on the Java Virtual Machine memory limits
(and eventually by the amount of disk allocated).
That is, if the application allocates a lot of large objects,
and the memory limit is reached, the cache would not be able
to hold more objects.
The cache replacement task is launched when the maximum number
of objects limit is nearly to be reached.
- setMaxObjects in interface CacheAttributeController
size
- The maximum number of objects to be held in cache.
(It must be a positive number).
CacheException
- if it is not possible to reduce the cache size
because all entries are fixed.
setMemorySize
public void setMemorySize(int size)
throws IllegalArgumentException
This method allows to set the maximum main-memory size
allocated to the cache. The size is limited by the actual
amount of memory allocated to the Java Virtual Machine.
- setMemorySize in interface CacheAttributeController
size
- The maximum memory size.
(It must be a positive number).
startFc
public void startFc()
stopFc
public void stopFc()
unbindFc
public void unbindFc(String s)