@MinMuleVersion(value="4.5.0") public interface ObjectStoreManager
ObjectStore instances.
Any component in need to use an ObjectStore should create it through an implementation of this interface.
This manager works under the concept of "Base Object Stores". This means that all created Object Stores are actually partitions on these base stores. This manager is in charge of creating and handling such partitions and exposing them as stand alone stores. There're two base object stores, one for the in memory ones and another for the transient ones.
All ObjectStore instances created through an instance of this interface, should also be destroyed through the same
instance using the disposeStore(String) method. This does not mean that all stores should necessarily be disposed. If
you want that store to endure through time, then you should not dispose it.
Implementations are required to be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
<T extends ObjectStore<? extends Serializable>> |
createObjectStore(String name,
ObjectStoreSettings settings)
Creates and returns a new
ObjectStore, configured according to the state of the settings object. |
void |
disposeStore(String name)
Clears the object store of the given
name and releases all resources associated to it, including memory, storage,
etc. |
<T extends ObjectStore<? extends Serializable>> |
getObjectStore(String name)
Returns an
ObjectStore previously defined through the createObjectStore(String, ObjectStoreSettings) method. |
<T extends ObjectStore<? extends Serializable>> |
getOrCreateObjectStore(String name,
ObjectStoreSettings settings)
Returns the
ObjectStore of name if it has already been defined. |
<T extends ObjectStore<? extends Serializable>> T getObjectStore(String name)
ObjectStore previously defined through the createObjectStore(String, ObjectStoreSettings) method.
If the name doesn't match with a store previously created through that method, or if the matching store was disposed
through disposeStore(String), then this method will throw NoSuchElementException.
The returned store has to be already open. Invokers should not have to call ObjectStore.open() on the returned
instance.
Otherwise, invoking this method several times using equivalent names will always result in the same instance being returned.
T - the generic type of the items in the storename - the name of the object storeObjectStoreNoSuchElementException - if the store doesn't exist or has been disposed<T extends ObjectStore<? extends Serializable>> T createObjectStore(String name, ObjectStoreSettings settings)
ObjectStore, configured according to the state of the settings object.
If is getObjectStore(String) after this method with an equivalent name, it will return the same instance as
this method.
The returned store has to be already open. Invokers should not have to call ObjectStore.open() on the returned
instance.
If this method is invoked with a name for which an ObjectStore has already been created, it will throw
IllegalArgumentException, if the settings of the two objects differ.
T - the generic type of the items in the storename - the name of the object storesettings - the object store configurationObjectStoreIllegalArgumentException - if the store already exists<T extends ObjectStore<? extends Serializable>> T getOrCreateObjectStore(String name, ObjectStoreSettings settings)
ObjectStore of name if it has already been defined. Otherwise, it delegates into
createObjectStore(String, ObjectStoreSettings) to create it.
Notice that if the store does actually exist, then the returned store might not actually match the provided settings
T - the generic type of the items in the storename - the name of the object storesettings - the object store configurationObjectStorevoid disposeStore(String name) throws org.mule.runtime.api.store.ObjectStoreException
name and releases all resources associated to it, including memory, storage,
etc.
The referenced store needs to have been created through the createObjectStore(String, ObjectStoreSettings) method or
a NoSuchElementException will be thrown.
name - the name of the ObjectStore to be disposed.org.mule.runtime.api.store.ObjectStoreExceptionCopyright © 2022. All rights reserved.