Package com.tangosol.persistence
Class SafePersistenceWrappers
java.lang.Object
com.tangosol.persistence.SafePersistenceWrappers
SafePersistenceWrappers provides safe wrapper implementations of persistence
layer interfaces that can be used to consolidate error handling across the
various persistence layers.
- Since:
- Coherence 12.1.3
- Author:
- rhl/jh 2013.07.18
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
FailureContinuationFactory encapsulates failure continuations to handle unexpected exceptions thrown by implementations of the various persistence layers.static class
SafePersistenceEnvironment is a wrapper PersistenceEnvironment implementation which protects all operations on the underlying environment (and any PersistenceManger or PersistentStore instances opened through this environment) from unexpected failures, delegating the exception handling to a failureContinuation
.static class
SafePersistenceManager is a wrapper PersistenceManager implementation which protects all operations on the underlying manager (and any PersistentStore instances opened by the manager) from unexpected failures, delegating the exception handling to a failureContinuation
.static class
SafePersistentStore is a wrapper PersistentStore implementation which protects all synchronous operations on the underlying store from unexpected failures, delegating the exception handling to a failureContinuation
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final SafePersistenceWrappers.FailureContinuationFactory
Default failure continuation factory that provides null continuations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static <R,
T extends Throwable>
SafePersistenceWrappers.FailureContinuationFactory<R, T> getSimpleFactory
(Continuation<? super T> cont) Return a simple FailureContinuationFactory that uses the specified failure continuation to handle failures at any layer of the persistence implementation.static <R> com.oracle.coherence.persistence.PersistenceEnvironment
<R> unwrap
(com.oracle.coherence.persistence.PersistenceEnvironment<R> env) Return the underlying (non-"Safe") PersistenceEnvironment.static <R> com.oracle.coherence.persistence.PersistenceManager
<R> unwrap
(com.oracle.coherence.persistence.PersistenceManager<R> mgr) Return the underlying (non-"Safe") PersistenceManager.static <R> com.oracle.coherence.persistence.PersistentStore
<R> unwrap
(com.oracle.coherence.persistence.PersistentStore<R> store) Return the underlying (non-"Safe") PersistentStore.
-
Field Details
-
DEFAULT_FACTORY
Default failure continuation factory that provides null continuations.
-
-
Constructor Details
-
SafePersistenceWrappers
public SafePersistenceWrappers()
-
-
Method Details
-
unwrap
public static <R> com.oracle.coherence.persistence.PersistenceEnvironment<R> unwrap(com.oracle.coherence.persistence.PersistenceEnvironment<R> env) Return the underlying (non-"Safe") PersistenceEnvironment.- Type Parameters:
R
- the type of a raw, environment specific object representation- Parameters:
env
- a PersistenceEnvironment- Returns:
- the underlying PersistenceEnvironment implementation
-
unwrap
public static <R> com.oracle.coherence.persistence.PersistenceManager<R> unwrap(com.oracle.coherence.persistence.PersistenceManager<R> mgr) Return the underlying (non-"Safe") PersistenceManager.- Type Parameters:
R
- the type of a raw, environment specific object representation- Parameters:
mgr
- a PersistenceManager- Returns:
- the underlying PersistenceManager implementation
-
unwrap
public static <R> com.oracle.coherence.persistence.PersistentStore<R> unwrap(com.oracle.coherence.persistence.PersistentStore<R> store) Return the underlying (non-"Safe") PersistentStore.- Type Parameters:
R
- the type of a raw, environment specific object representation- Parameters:
store
- a PersistentStore- Returns:
- the underlying PersistentStore implementation
-
getSimpleFactory
protected static <R,T extends Throwable> SafePersistenceWrappers.FailureContinuationFactory<R,T> getSimpleFactory(Continuation<? super T> cont) Return a simple FailureContinuationFactory that uses the specified failure continuation to handle failures at any layer of the persistence implementation.- Type Parameters:
R
- the type of a raw, environment specific object representationT
- the type of a Throwable failure to protect- Parameters:
cont
- the failure continuation- Returns:
- a simple FailureContinuationFactory that uses a single common failure continuation
-