public class MRUMemoryStore extends org.apache.avalon.framework.logger.AbstractLogEnabled implements Store, org.apache.avalon.framework.parameters.Parameterizable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.excalibur.instrument.Instrumentable, org.apache.avalon.framework.component.Component
| Modifier and Type | Field and Description |
|---|---|
private java.util.Hashtable |
m_cache |
private org.apache.excalibur.instrument.CounterInstrument |
m_hitsInstrument |
private java.lang.String |
m_instrumentableName |
private org.apache.avalon.framework.service.ServiceManager |
m_manager |
private int |
m_maxobjects |
private org.apache.excalibur.instrument.CounterInstrument |
m_missesInstrument |
private java.util.LinkedList |
m_mrulist |
private boolean |
m_persistent |
private Store |
m_persistentStore |
private org.apache.excalibur.instrument.ValueInstrument |
m_sizeInstrument |
private StoreJanitor |
m_storeJanitor |
PERSISTENT_STORE, ROLE, TRANSIENT_STORE| Constructor and Description |
|---|
MRUMemoryStore() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
checkSerializable(java.lang.Object object)
This method checks if an object is seriazable.
|
void |
clear()
Clear the Store of all elements
|
boolean |
containsKey(java.lang.Object key)
Indicates if the given key is associated to a contained object.
|
void |
dispose()
Dispose the component
|
void |
free()
Frees some of the fast memory used by this store.
|
java.lang.Object |
get(java.lang.Object key)
Get the object associated to the given unique key.
|
org.apache.excalibur.instrument.Instrumentable[] |
getChildInstrumentables() |
java.lang.String |
getInstrumentableName() |
org.apache.excalibur.instrument.Instrument[] |
getInstruments() |
void |
hold(java.lang.Object key,
java.lang.Object value)
This method holds the requested object in a HashMap combined
with a LinkedList to create the MRU.
|
java.util.Enumeration |
keys()
Returns the list of used keys as an Enumeration.
|
void |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Initialize the MRUMemoryStore.
|
void |
remove(java.lang.Object key)
Remove the object associated to the given key.
|
void |
service(org.apache.avalon.framework.service.ServiceManager manager)
Get components of the ComponentLocator
|
void |
setInstrumentableName(java.lang.String name) |
int |
size()
Returns count of the objects in the store, or -1 if could not be
obtained.
|
void |
store(java.lang.Object key,
java.lang.Object value)
Store the given object in a persistent state.
|
private java.lang.String m_instrumentableName
private int m_maxobjects
private boolean m_persistent
private java.util.Hashtable m_cache
private java.util.LinkedList m_mrulist
private Store m_persistentStore
private StoreJanitor m_storeJanitor
private org.apache.avalon.framework.service.ServiceManager m_manager
private org.apache.excalibur.instrument.ValueInstrument m_sizeInstrument
private org.apache.excalibur.instrument.CounterInstrument m_hitsInstrument
private org.apache.excalibur.instrument.CounterInstrument m_missesInstrument
public void service(org.apache.avalon.framework.service.ServiceManager manager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceablemanager - The ComponentLocatororg.apache.avalon.framework.service.ServiceExceptionpublic void parameterize(org.apache.avalon.framework.parameters.Parameters params)
throws org.apache.avalon.framework.parameters.ParameterException
parameterize in interface org.apache.avalon.framework.parameters.Parameterizableparams - Store parametersorg.apache.avalon.framework.parameters.ParameterExceptionpublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposablepublic void store(java.lang.Object key,
java.lang.Object value)
public void hold(java.lang.Object key,
java.lang.Object value)
key - The key of the object to be storedvalue - The object to be storedpublic java.lang.Object get(java.lang.Object key)
public void remove(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
containsKey in interface Storekey - The key of the objectpublic java.util.Enumeration keys()
public int size()
public void free()
private boolean checkSerializable(java.lang.Object object)
object - The object to be checkedpublic void setInstrumentableName(java.lang.String name)
setInstrumentableName in interface org.apache.excalibur.instrument.Instrumentablepublic java.lang.String getInstrumentableName()
getInstrumentableName in interface org.apache.excalibur.instrument.Instrumentablepublic org.apache.excalibur.instrument.Instrument[] getInstruments()
getInstruments in interface org.apache.excalibur.instrument.Instrumentablepublic org.apache.excalibur.instrument.Instrumentable[] getChildInstrumentables()
getChildInstrumentables in interface org.apache.excalibur.instrument.Instrumentable