Class SafePersistenceWrappers.SafePersistentStore<R,T extends Throwable>
- All Implemented Interfaces:
com.oracle.coherence.persistence.PersistentStore<R>
- Enclosing class:
SafePersistenceWrappers
Continuation
. The handling of failures encountered during
asynchronous processing remains the responsibility of the Collector
used to open the asynchronous transaction.-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.NullImplementation.NullPersistentStore
NullImplementation.NullPersistentStore.Token
Nested classes/interfaces inherited from interface com.oracle.coherence.persistence.PersistentStore
com.oracle.coherence.persistence.PersistentStore.Visitor<R>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Continuation
<? super T> The failure continuation for this store.protected final com.oracle.coherence.persistence.PersistentStore
<R> The underlying PersistentStore.Fields inherited from class com.tangosol.util.NullImplementation.NullPersistentStore
INSTANCE
-
Constructor Summary
ConstructorDescriptionSafePersistentStore
(com.oracle.coherence.persistence.PersistentStore<R> store) Construct a SafePersistentStore backed by the specified store.SafePersistentStore
(com.oracle.coherence.persistence.PersistentStore<R> store, Continuation<? super T> cont) Construct a SafePersistentStore backed by the specified store.SafePersistentStore
(com.oracle.coherence.persistence.PersistentStore<R> store, SafePersistenceWrappers.FailureContinuationFactory<R, ? super T> factory) Construct a PersistenceManager backed by the specified manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort an atomic sequence of mutating operations.begin()
Begin a new sequence of mutating operations that should be committed to the store as an atomic unit.Begin a new sequence of mutating operations that should be committed to the store asynchronously as an atomic unit.void
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
Remove the specified key from the underlying store if present.Suggest to this PersistentStore that the caller requires exclusive access to this store untilclose
is called on the returnedAutoCloseable
.long[]
extents()
Return a list of the extent identifiers in the underlying store.getId()
Return the identifier of this store.com.oracle.coherence.persistence.PersistentStore
<R> getStore()
Return the underlying PersistentStore.void
Iterate the key-value pairs in the persistent store, applying the specified visitor to each key-value pair.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 the specified value under the specific key in the underlying store.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.
-
Field Details
-
f_store
The underlying PersistentStore. -
f_contFailure
The failure continuation for this store.
-
-
Constructor Details
-
SafePersistentStore
Construct a SafePersistentStore backed by the specified store.- Parameters:
store
- the PersistentStore to protect against exceptions
-
SafePersistentStore
public SafePersistentStore(com.oracle.coherence.persistence.PersistentStore<R> store, Continuation<? super T> cont) Construct a SafePersistentStore backed by the specified store.- Parameters:
store
- the underlying PersistentStorecont
- the failure continuation to use to handle unexpected exceptions
-
SafePersistentStore
public SafePersistentStore(com.oracle.coherence.persistence.PersistentStore<R> store, SafePersistenceWrappers.FailureContinuationFactory<R, ? super T> factory) Construct a PersistenceManager backed by the specified manager.- Parameters:
store
- the underlying PersistentStorefactory
- the failure continuation factory to use to create handlers for unexpected exceptions
-
-
Method Details
-
getStore
Return the underlying PersistentStore.- Returns:
- the underlying PersistentStore
-
onException
Called to handle an unexpected exception.- Parameters:
t
- the Throwable
-
getId
Return the identifier of this store.- Specified by:
getId
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
getId
in classNullImplementation.NullPersistentStore<R>
- Returns:
- the identifier that was used to open this store
-
ensureExtent
public boolean ensureExtent(long lExtentId) Ensure that an extent with the given identifier exists in the persistent store, returning true iff the extent was created.- Specified by:
ensureExtent
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
ensureExtent
in classNullImplementation.NullPersistentStore<R>
- Parameters:
lExtentId
- the identifier of the extent to ensure- Returns:
- true iff the specified extent did not previously exist
-
deleteExtent
public 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.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.
- Specified by:
deleteExtent
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
deleteExtent
in classNullImplementation.NullPersistentStore<R>
- Parameters:
lExtentId
- the identifier of the extent to delete
-
moveExtent
public void moveExtent(long lOldExtentId, long lNewExtentId) Move the specified extent from the old extent id to the new extent id.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 tostore
are permitted immediately after control is returned.- Specified by:
moveExtent
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
moveExtent
in classNullImplementation.NullPersistentStore<R>
- Parameters:
lOldExtentId
- the old extent identifierlNewExtentId
- the new extent identifier
-
truncateExtent
public void truncateExtent(long lExtentId) Truncate the specified extent from the persistent store, ensuring that any key-value mappings associated with the extent are removed.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.
- Specified by:
truncateExtent
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
truncateExtent
in classNullImplementation.NullPersistentStore<R>
- Parameters:
lExtentId
- the identifier of the extent to truncate
-
extents
public long[] extents()Return a list of the extent identifiers in the underlying store.- Specified by:
extents
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
extents
in classNullImplementation.NullPersistentStore<R>
- Returns:
- a list of the extent identifiers in the underlying store
-
exclusively
Suggest to this PersistentStore that the caller requires exclusive access to this store untilclose
is called on the returnedAutoCloseable
.Note: the caller must call
close
on the returned object- Returns:
- an
AutoCloseable
object that requires close to be called on it when exclusive access is no longer needed
-
load
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.- Specified by:
load
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
load
in classNullImplementation.NullPersistentStore<R>
- Parameters:
lExtentId
- the extent identifier for the keykey
- key whose associated value is to be returned- Returns:
- the value associated with the specified key, or null if no value is available for that key
-
store
Store the specified value under the specific key in the underlying store. This method is intended to support both key-value pair creation and value update for a specific key.- Specified by:
store
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
store
in classNullImplementation.NullPersistentStore<R>
- Parameters:
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
-
erase
Remove the specified key from the underlying store if present.- Specified by:
erase
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
erase
in classNullImplementation.NullPersistentStore<R>
- Parameters:
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 method
-
iterate
Iterate the key-value pairs in the persistent store, applying the specified visitor to each key-value pair.- Specified by:
iterate
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
iterate
in classNullImplementation.NullPersistentStore<R>
- Parameters:
visitor
- the visitor to apply
-
begin
Begin a new sequence of mutating operations that should be committed to the store as an atomic unit. The returned token should be passed to all mutating operations that should be part of the atomic unit. Once the sequence of operations have been performed, they must either becommitted
to the store or the atomic unit must beaborted
.- Specified by:
begin
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
begin
in classNullImplementation.NullPersistentStore<R>
- Returns:
- a token that represents the atomic unit
-
begin
Begin a new sequence of mutating operations that should be committed to the store asynchronously as an atomic unit. The returned token should be passed to all mutating operations that should be part of the atomic unit. Once the sequence of operations have been performed, they must either becommitted
to the store or the atomic unit must beaborted
.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, anAsyncPersistenceException
that wraps the cause and specified receipt will be added. Finally, the collector will be flushed.- Specified by:
begin
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
begin
in classNullImplementation.NullPersistentStore<R>
- Parameters:
collector
- an optional collectoroReceipt
- a receipt to be added to the collector (if any) when the unit is committed- Returns:
- a token representing the atomic unit that will be committed asynchronously
-
commit
Commit a sequence of mutating operations represented by the given token as an atomic unit.- Specified by:
commit
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
commit
in classNullImplementation.NullPersistentStore<R>
- Parameters:
oToken
- a token that represents the atomic unit to commit
-
abort
Abort an atomic sequence of mutating operations.- Specified by:
abort
in interfacecom.oracle.coherence.persistence.PersistentStore<R>
- Overrides:
abort
in classNullImplementation.NullPersistentStore<R>
- Parameters:
oToken
- a token that represents the atomic unit to abort
-
toString
Return a human readable description of this SafePersistentStore.
-