org.mule.util.store
Class InMemoryObjectStore<T extends Serializable>
java.lang.Object
org.mule.util.store.AbstractMonitoredObjectStore<T>
org.mule.util.store.InMemoryObjectStore<T>
- All Implemented Interfaces:
- Runnable, MuleContextAware, Disposable, Initialisable, ObjectStore<T>
- Direct Known Subclasses:
- TextFileObjectStore
public class InMemoryObjectStore<T extends Serializable>
- extends AbstractMonitoredObjectStore<T>
InMemoryObjectStore implements an optionally bounded
in-memory store for message IDs with periodic expiry of old entries. The bounded size
is a soft limit and only enforced periodically by the expiry process; this
means that the store may temporarily exceed its maximum size between expiry runs, but
will eventually shrink to its configured size.
|
Field Summary |
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentSkipListMap |
store
|
| Methods inherited from class org.mule.util.store.AbstractMonitoredObjectStore |
dispose, getEntryTTL, getExpirationInterval, getMaxEntries, getName, getScheduler, initialise, run, setEntryTTL, setExpirationInterval, setMaxEntries, setMuleContext, setName, setScheduler |
store
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentSkipListMap store
InMemoryObjectStore
public InMemoryObjectStore()
contains
public boolean contains(Serializable key)
throws ObjectStoreException
- Check whether the given Object is already registered with this store.
- Parameters:
key - the identifier of the object to check
- Returns:
true if the key is stored or false no value was stored for
the key.
- Throws:
ObjectStoreException - if the given key is null.
ObjectStoreNotAvaliableException - if any implementation-specific error occured, e.g.
when the store is not available
store
public void store(Serializable id,
T value)
throws ObjectStoreException
- Store the given Object.
- Parameters:
id - the identifier for valuevalue - the Object to store with key
- Throws:
ObjectStoreException - if the given key cannot be stored or is null.
ObjectStoreNotAvaliableException - if the store is not available or any other
implementation-specific error occured.
ObjectAlreadyExistsException - if an attempt is made to store an object for a key
that already has an object associated.
retrieve
public T retrieve(Serializable key)
throws ObjectStoreException
- Retrieve the given Object.
- Parameters:
key - the identifier of the object to retrieve.
- Returns:
- the object associated with the given key. If no object for the given key was found
this method throws an
ObjectDoesNotExistException.
- Throws:
ObjectStoreException - if the given key is null.
ObjectStoreNotAvaliableException - if the store is not available or any other
implementation-specific error occured.
ObjectDoesNotExistException - if no value for the given key was previously stored.
remove
public T remove(Serializable key)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Remove the object with key.
- Parameters:
key - the identifier of the object to remove.
- Returns:
- the object that was previously stored for the given key
- Throws:
ObjectStoreException - if the given key is null or if the store is not
available or any other implementation-specific error occured
ObjectDoesNotExistException - if no value for the given key was previously stored.
expire
public void expire()
- Specified by:
expire in class AbstractMonitoredObjectStore<T extends Serializable>
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2003-2011 MuleSoft, Inc.. All Rights Reserved.