|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.util.store.MonitoredObjectStoreWrapper<T>
public class MonitoredObjectStoreWrapper<T extends Serializable>
The MonitoredObjectStoreWrapper wraps an ObjectStore which does not support direct expiry and adds this behavior
Nested Class Summary | |
---|---|
protected static class |
MonitoredObjectStoreWrapper.StoredObject<T>
|
Field Summary | |
---|---|
protected MuleContext |
context
|
protected int |
entryTTL
The time-to-live for each message ID, specified in milliseconds, or -1 for entries that should never expire. |
protected int |
expirationInterval
The interval for periodic bounded size enforcement and entry expiration, specified in milliseconds. |
protected int |
maxEntries
the maximum number of entries that this store keeps around. |
protected String |
name
A name for this store, can be used for logging and identification purposes. |
protected ScheduledThreadPoolExecutor |
scheduler
|
Fields inherited from interface org.mule.api.lifecycle.Initialisable |
---|
PHASE_NAME |
Fields inherited from interface org.mule.api.lifecycle.Disposable |
---|
PHASE_NAME |
Constructor Summary | |
---|---|
MonitoredObjectStoreWrapper(ListableObjectStore<MonitoredObjectStoreWrapper.StoredObject<T>> baseStore)
|
|
MonitoredObjectStoreWrapper(ListableObjectStore<MonitoredObjectStoreWrapper.StoredObject<T>> baseStore,
int maxEntries,
int entryTTL,
int expirationInterval)
|
Method Summary | |
---|---|
List<Serializable> |
allKeys()
|
void |
close()
Close the underlying store. |
boolean |
contains(Serializable key)
Check whether the given Object is already registered with this store. |
void |
dispose()
A lifecycle method where implementor should free up any resources. |
void |
expire()
|
void |
initialise()
Method used to perform any initialisation work. |
boolean |
isPersistent()
Is this store persistent? |
void |
open()
Open the underlying store. |
T |
remove(Serializable key)
Remove the object with key. |
T |
retrieve(Serializable key)
Retrieve the given Object. |
void |
run()
|
void |
setMuleContext(MuleContext context)
|
void |
store(Serializable key,
T value)
Store the given Object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MuleContext context
protected ScheduledThreadPoolExecutor scheduler
protected int maxEntries
protected int entryTTL
protected int expirationInterval
protected String name
Constructor Detail |
---|
public MonitoredObjectStoreWrapper(ListableObjectStore<MonitoredObjectStoreWrapper.StoredObject<T>> baseStore)
public MonitoredObjectStoreWrapper(ListableObjectStore<MonitoredObjectStoreWrapper.StoredObject<T>> baseStore, int maxEntries, int entryTTL, int expirationInterval)
Method Detail |
---|
public boolean contains(Serializable key) throws ObjectStoreException
ObjectStore
contains
in interface ObjectStore<T extends Serializable>
key
- the identifier of the object to check
true
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 key, T value) throws ObjectStoreException
ObjectStore
store
in interface ObjectStore<T extends Serializable>
key
- 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
retrieve
in interface ObjectStore<T extends Serializable>
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
remove
in interface ObjectStore<T extends Serializable>
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 occured
ObjectDoesNotExistException
- if no value for the given key was previously stored.public boolean isPersistent()
ObjectStore
isPersistent
in interface ObjectStore<T extends Serializable>
public void open() throws ObjectStoreException
ListableObjectStore
open
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while opening the underlying store.public void close() throws ObjectStoreException
ListableObjectStore
close
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while closing the underlying store.public List<Serializable> allKeys() throws ObjectStoreException
allKeys
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while collecting the list of all keys.public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
public void run()
run
in interface Runnable
public void expire()
public void dispose()
Disposable
dispose
in interface Disposable
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |