org.mule.util.store
Class InMemoryObjectStore<T extends java.io.Serializable>
java.lang.Object
org.mule.util.store.AbstractMonitoredObjectStore<T>
org.mule.util.store.InMemoryObjectStore<T>
- All Implemented Interfaces:
- java.lang.Runnable, MuleContextAware, Disposable, Initialisable, ObjectStore<T>
- Direct Known Subclasses:
- TextFileObjectStore
public class InMemoryObjectStore<T extends java.io.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
|
Method Summary |
boolean |
contains(java.io.Serializable key)
Check whether the given Object is already registered with this store. |
void |
expire()
|
T |
remove(java.io.Serializable key)
Remove the object with key. |
T |
retrieve(java.io.Serializable key)
Retrieve the given Object. |
void |
store(java.io.Serializable id,
T value)
Store the given Object. |
java.lang.String |
toString()
|
Methods inherited from class org.mule.util.store.AbstractMonitoredObjectStore |
dispose, getEntryTTL, getExpirationInterval, getMaxEntries, getName, getScheduler, initialise, run, setEntryTTL, setExpirationInterval, setMaxEntries, setMuleContext, setName, setScheduler |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
store
protected edu.emory.mathcs.backport.java.util.concurrent.ConcurrentSkipListMap store
InMemoryObjectStore
public InMemoryObjectStore()
contains
public boolean contains(java.io.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(java.io.Serializable id,
T value)
throws ObjectStoreException
- Store the given Object.
- Parameters:
id
- the identifier for value
value
- 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(java.io.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(java.io.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 java.io.Serializable>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.