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.Modifier and Type | Class and Description |
---|---|
protected static class |
InMemoryObjectStore.StoredObject<T>
Represents the object stored in the store.
|
Modifier and Type | Field and Description |
---|---|
protected ConcurrentSkipListMap<Long,InMemoryObjectStore.StoredObject<T>> |
store |
context, entryTTL, expirationInterval, logger, maxEntries, name, scheduler
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
InMemoryObjectStore() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all items of this store without disposing it, meaning that after
performing a clear(), you should still be able perform other operations.
|
boolean |
contains(Serializable key)
Check whether the given Object is already registered with this store.
|
void |
expire() |
boolean |
isPersistent()
Is this store persistent?
|
T |
remove(Serializable key)
Remove the object with key.
|
T |
retrieve(Serializable key)
Retrieve the given Object.
|
void |
store(Serializable id,
T value)
Store the given Object.
|
String |
toString() |
dispose, getEntryTTL, getExpirationInterval, getMaxEntries, getMuleContext, getName, getScheduler, initialise, run, setEntryTTL, setExpirationInterval, setMaxEntries, setMuleContext, setName, setScheduler
protected ConcurrentSkipListMap<Long,InMemoryObjectStore.StoredObject<T extends Serializable>> store
public boolean isPersistent()
ObjectStore
public boolean contains(Serializable key) throws ObjectStoreException
ObjectStore
key
- the identifier of the object to checktrue
if the key is stored or false
no value
was stored for the key.ObjectStoreException
- if the given key is null
.ObjectStoreNotAvaliableException
- if any implementation-specific error
occured, e.g. when the store is not availablepublic void store(Serializable id, T value) throws ObjectStoreException
ObjectStore
id
- the identifier for value
value
- the Object to store with key
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.public T retrieve(Serializable key) throws ObjectStoreException
ObjectStore
key
- the identifier of the object to retrieve.ObjectDoesNotExistException
.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.public T remove(Serializable key) throws ObjectStoreException
ObjectStore
key
- the identifier of the object to remove.ObjectStoreException
- if the given key is null
or if the
store is not available or any other implementation-specific error
occuredObjectDoesNotExistException
- if no value for the given key was
previously stored.public void clear() throws ObjectStoreException
ObjectStore
ObjectStoreException
- if the operation failspublic void expire()
expire
in class AbstractMonitoredObjectStore<T extends Serializable>
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.