public static class SafePersistenceWrappers.SafePersistentStore<R,T extends Throwable> extends NullImplementation.NullPersistentStore<R>
Continuation. The handling of failures encountered during asynchronous processing remains the responsibility of the Collector used to open the asynchronous transaction.NullImplementation.NullPersistentStore.Token| Modifier and Type | Field and Description |
|---|---|
protected Continuation<? super T> |
f_contFailure
The failure continuation for this store.
|
protected com.oracle.datagrid.persistence.PersistentStore<R> |
f_store
The underlying PersistentStore.
|
INSTANCE| Constructor and Description |
|---|
SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store)
Construct a SafePersistentStore backed by the specified store.
|
SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store, Continuation<? super T> cont)
Construct a SafePersistentStore backed by the specified store.
|
SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store, SafePersistenceWrappers.FailureContinuationFactory<R,? super T> factory)
Construct a PersistenceManager backed by the specified manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Object oToken)
Abort an atomic sequence of mutating operations.
|
Object |
begin()
Begin a new sequence of mutating operations that should be committed to the store as an atomic unit.
|
Object |
begin(Collector<Object> collector, Object oReceipt)
Begin a new sequence of mutating operations that should be committed to the store asynchronously as an atomic unit.
|
void |
commit(Object oToken)
Commit a sequence of mutating operations represented by the given token as an atomic unit.
|
void |
deleteExtent(long lExtentId)
Delete the specified extent from the persistent store, ensuring that any key-value mappings associated with the extent are no longer valid.
|
boolean |
ensureExtent(long lExtentId)
Ensure that an extent with the given identifier exists in the persistent store, returning true iff the extent was created.
|
void |
erase(long lExtentId, R key, Object oToken)
Remove the specified key from the underlying store if present.
|
long[] |
extents()
Return a list of the extent identifiers in the underlying store.
|
String |
getId()
Return the identifier of this store.
|
com.oracle.datagrid.persistence.PersistentStore<R> |
getStore()
Return the underlying PersistentStore.
|
void |
iterate(com.oracle.datagrid.persistence.PersistentStore.Visitor<R> visitor)
Iterate the key-value pairs in the persistent store, applying the specified visitor to each key-value pair.
|
R |
load(long lExtentId, R key)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
|
void |
moveExtent(long lOldExtentId, long lNewExtentId)
Move the specified extent from the old extent id to the new extent id.
|
void |
onException(T t)
Called to handle an unexpected exception.
|
void |
store(long lExtentId, R key, R value, Object oToken)
Store the specified value under the specific key in the underlying store.
|
String |
toString()
Return a human readable description of this SafePersistentStore.
|
void |
truncateExtent(long lExtentId)
Truncate the specified extent from the persistent store, ensuring that any key-value mappings associated with the extent are removed.
|
protected final com.oracle.datagrid.persistence.PersistentStore<R> f_store
protected final Continuation<? super T extends Throwable> f_contFailure
public SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store)
store - the PersistentStore to protect against exceptionspublic SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store, Continuation<? super T> cont)
store - the underlying PersistentStorecont - the failure continuation to use to handle unexpected exceptionspublic SafePersistentStore(com.oracle.datagrid.persistence.PersistentStore<R> store, SafePersistenceWrappers.FailureContinuationFactory<R,? super T> factory)
store - the underlying PersistentStorefactory - the failure continuation factory to use to create handlers for unexpected exceptionspublic com.oracle.datagrid.persistence.PersistentStore<R> getStore()
public void onException(T t)
t - the Throwablepublic String getId()
getId in interface com.oracle.datagrid.persistence.PersistentStore<R>getId in class NullImplementation.NullPersistentStore<R>public boolean ensureExtent(long lExtentId)
ensureExtent in interface com.oracle.datagrid.persistence.PersistentStore<R>ensureExtent in class NullImplementation.NullPersistentStore<R>lExtentId - the identifier of the extent to ensurepublic void deleteExtent(long lExtentId)
Removal of the key-value mappings associated with the extent from the underlying storage is the responsibility of the implementation, and may (for example) be performed immediately, asynchronously, or deferred until space is required.
deleteExtent in interface com.oracle.datagrid.persistence.PersistentStore<R>deleteExtent in class NullImplementation.NullPersistentStore<R>lExtentId - the identifier of the extent to delete
public void moveExtent(long lOldExtentId,
long lNewExtentId)
Upon control being returned the implementation guarantees that any data data that used to reside against the old extent id is accessible from new extent id using the load API. In addition, calls to store are permitted immediately after control is returned.
moveExtent in interface com.oracle.datagrid.persistence.PersistentStore<R>moveExtent in class NullImplementation.NullPersistentStore<R>lOldExtentId - the old extent identifierlNewExtentId - the new extent identifierpublic void truncateExtent(long lExtentId)
Removal of the key-value mappings associated with the extent from the underlying storage is the responsibility of the implementation, and may (for example) be performed immediately, asynchronously, or deferred until space is required.
truncateExtent in interface com.oracle.datagrid.persistence.PersistentStore<R>truncateExtent in class NullImplementation.NullPersistentStore<R>lExtentId - the identifier of the extent to truncatepublic long[] extents()
extents in interface com.oracle.datagrid.persistence.PersistentStore<R>extents in class NullImplementation.NullPersistentStore<R>public R load(long lExtentId, R key)
load in interface com.oracle.datagrid.persistence.PersistentStore<R>load in class NullImplementation.NullPersistentStore<R>lExtentId - the extent identifier for the keykey - key whose associated value is to be returned
public void store(long lExtentId,
R key,
R value,
Object oToken)
store in interface com.oracle.datagrid.persistence.PersistentStore<R>store in class NullImplementation.NullPersistentStore<R>lExtentId - the extent identifier for the key-value pairkey - key to store the value undervalue - value to be storedoToken - optional token that represents a set of mutating operations to be committed as an atomic unit; if null, the given key-value pair will be committed to the store automatically by this method
public void erase(long lExtentId,
R key,
Object oToken)
erase in interface com.oracle.datagrid.persistence.PersistentStore<R>erase in class NullImplementation.NullPersistentStore<R>lExtentId - the extent identifier for the keykey - key whose mapping is to be removedoToken - optional token that represents a set of mutating operations to be committed as an atomic unit; if null, the removal of the given key will be committed to the store automatically by this methodpublic void iterate(com.oracle.datagrid.persistence.PersistentStore.Visitor<R> visitor)
iterate in interface com.oracle.datagrid.persistence.PersistentStore<R>iterate in class NullImplementation.NullPersistentStore<R>visitor - the visitor to applypublic Object begin()
committed to the store or the atomic unit must be aborted.begin in interface com.oracle.datagrid.persistence.PersistentStore<R>begin in class NullImplementation.NullPersistentStore<R>public Object begin(Collector<Object> collector, Object oReceipt)
committed to the store or the atomic unit must be aborted.
If a collector is passed to this method, the specified receipt will be added to it when the unit is committed. If the operation is aborted or an error occurs during the commit, an AsyncPersistenceException that wraps the cause and specified receipt will be added. Finally, the collector will be flushed.
begin in interface com.oracle.datagrid.persistence.PersistentStore<R>begin in class NullImplementation.NullPersistentStore<R>collector - an optional collectoroReceipt - a receipt to be added to the collector (if any) when the unit is committedpublic void commit(Object oToken)
commit in interface com.oracle.datagrid.persistence.PersistentStore<R>commit in class NullImplementation.NullPersistentStore<R>oToken - a token that represents the atomic unit to commitpublic void abort(Object oToken)
abort in interface com.oracle.datagrid.persistence.PersistentStore<R>abort in class NullImplementation.NullPersistentStore<R>oToken - a token that represents the atomic unit to abort