org.mule.util.store
Class InMemoryObjectStore
java.lang.Object
org.mule.util.store.AbstractMonitoredObjectStore
org.mule.util.store.InMemoryObjectStore
- All Implemented Interfaces:
- Runnable, MuleContextAware, Disposable, Initialisable, ObjectStore
- Direct Known Subclasses:
- TextFileObjectStore
public class InMemoryObjectStore
- extends AbstractMonitoredObjectStore
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()
containsObject
public boolean containsObject(String id)
throws Exception
- Check whether the given Object is already registered with this store.
- Parameters:
id - the ID to check
- Returns:
true if the ID is stored or false if it could
not be found
- Throws:
IllegalArgumentException - if the given ID is null
Exception - if any implementation-specific error occured, e.g. when the store
is not available
storeObject
public boolean storeObject(String id,
Object item)
throws Exception
- Store the given Object.
- Parameters:
id - the ID to storeitem - the Object to store with the id
- Returns:
true if the ID was stored properly, or false
if it already existed
- Throws:
IllegalArgumentException - if the given ID cannot be stored or is
null
Exception - if the store is not available or any other
implementation-specific error occured
retrieveObject
public Object retrieveObject(String id)
throws Exception
- Retrieve the given Object.
- Parameters:
id - the ID to store
- Returns:
- the object instance associated with this id or null if there was no entry for the supplied id.
- Throws:
IllegalArgumentException - if the given ID cannot be stored or is
null
Exception - if the store is not available or any other
implementation-specific error occured
removeObject
public boolean removeObject(String id)
throws Exception
- Throws:
Exception
expire
public void expire()
- Specified by:
expire in class AbstractMonitoredObjectStore
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.