Package com.tangosol.persistence
Class SafePersistenceWrappers
- java.lang.Object
-
- com.tangosol.persistence.SafePersistenceWrappers
-
public class SafePersistenceWrappers extends Object
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
Nested Classes Modifier and Type Class Description static interface
SafePersistenceWrappers.FailureContinuationFactory<R,T extends Throwable>
FailureContinuationFactory encapsulates failure continuations to handle unexpected exceptions thrown by implementations of the various persistence layers.static class
SafePersistenceWrappers.SafePersistenceEnvironment<R,T extends Throwable>
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
SafePersistenceWrappers.SafePersistenceManager<R,T extends Throwable>
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
SafePersistenceWrappers.SafePersistentStore<R,T extends Throwable>
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
Fields Modifier and Type Field Description static SafePersistenceWrappers.FailureContinuationFactory
DEFAULT_FACTORY
Default failure continuation factory that provides null continuations.
-
Constructor Summary
Constructors Constructor Description SafePersistenceWrappers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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 Detail
-
DEFAULT_FACTORY
public static final SafePersistenceWrappers.FailureContinuationFactory DEFAULT_FACTORY
Default failure continuation factory that provides null continuations.
-
-
Method Detail
-
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
-
-