Package com.tangosol.persistence
Class SafePersistenceWrappers.SafePersistenceEnvironment<R,T extends Throwable>
java.lang.Object
com.tangosol.util.NullImplementation.NullPersistenceEnvironment<R>
com.tangosol.persistence.SafePersistenceWrappers.SafePersistenceEnvironment<R,T>
- Type Parameters:
R
- the type of a raw, environment specific object representationT
- the type of a Throwable failure to protect
- All Implemented Interfaces:
com.oracle.coherence.persistence.PersistenceEnvironment<R>
- Enclosing class:
SafePersistenceWrappers
public static class SafePersistenceWrappers.SafePersistenceEnvironment<R,T extends Throwable>
extends NullImplementation.NullPersistenceEnvironment<R>
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 failure
Continuation
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final Continuation
<? super T> The failure continuation for this environment.protected final com.oracle.coherence.persistence.PersistenceEnvironment
<R> The underlying PersistenceEnvironment.protected final SafePersistenceWrappers.FailureContinuationFactory
<R, ? super T> The FailureContinuationFactory.Fields inherited from class com.tangosol.util.NullImplementation.NullPersistenceEnvironment
INSTANCE
-
Constructor Summary
ConstructorDescriptionSafePersistenceEnvironment
(com.oracle.coherence.persistence.PersistenceEnvironment<R> env) Construct a PersistenceEnvironment backed by the specified environment.SafePersistenceEnvironment
(com.oracle.coherence.persistence.PersistenceEnvironment<R> env, Continuation<? super Throwable> cont) Construct a PersistenceEnvironment backed by the specified environment.SafePersistenceEnvironment
(com.oracle.coherence.persistence.PersistenceEnvironment<R> env, SafePersistenceWrappers.FailureContinuationFactory<R, ? super T> factory) Construct a PersistenceEnvironment backed by the specified environment. -
Method Summary
Modifier and TypeMethodDescriptioncom.oracle.coherence.persistence.PersistenceManager
<R> createSnapshot
(String sSnapshot, com.oracle.coherence.persistence.PersistenceManager<R> manager) Create a PersistenceManager used to manage the snapshot with the specified identifier.com.oracle.coherence.persistence.PersistenceEnvironment
<R> Return the underlying PersistenceEnvironment.String[]
Return the identifiers of the snapshots known to this environment.protected void
onException
(T t) Called to handle an unexpected exception.com.oracle.coherence.persistence.PersistenceManager
<R> Open and return the singleton active PersistenceManager.com.oracle.coherence.persistence.PersistenceManager
<R> Open and return a singleton PersistenceManager to store backup data.com.oracle.coherence.persistence.PersistenceManager
<R> Open and return a singleton PersistenceManager to store MapEvents.com.oracle.coherence.persistence.PersistenceManager
<R> openSnapshot
(String sSnapshot) Open a PersistenceManager used to access the snapshot with the specified identifier.void
release()
Release all resources held by this environment.boolean
removeSnapshot
(String sSnapshot) Remove the persistent artifacts associated with the snapshot with the specified identifier.toString()
Return a human readable description of this SafePersistenceEnvironment.protected com.oracle.coherence.persistence.PersistenceManager
Wrap the specified manager in a SafePersistenceManager implementation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.coherence.persistence.PersistenceEnvironment
createSnapshot
-
Field Details
-
f_env
The underlying PersistenceEnvironment. -
f_contFailure
The failure continuation for this environment. -
f_factoryCont
protected final SafePersistenceWrappers.FailureContinuationFactory<R,? super T extends Throwable> f_factoryContThe FailureContinuationFactory.
-
-
Constructor Details
-
SafePersistenceEnvironment
Construct a PersistenceEnvironment backed by the specified environment.- Parameters:
env
- the underlying PersistenceEnvironment
-
SafePersistenceEnvironment
public SafePersistenceEnvironment(com.oracle.coherence.persistence.PersistenceEnvironment<R> env, Continuation<? super Throwable> cont) Construct a PersistenceEnvironment backed by the specified environment.- Parameters:
env
- the underlying PersistenceEnvironmentcont
- the failure continuation to use to handle unexpected exceptions
-
SafePersistenceEnvironment
public SafePersistenceEnvironment(com.oracle.coherence.persistence.PersistenceEnvironment<R> env, SafePersistenceWrappers.FailureContinuationFactory<R, ? super T> factory) Construct a PersistenceEnvironment backed by the specified environment.- Parameters:
env
- the underlying PersistenceEnvironmentfactory
- the failure continuation factory to use to create handlers for unexpected exceptions
-
-
Method Details
-
getEnvironment
Return the underlying PersistenceEnvironment.- Returns:
- the underlying PersistenceEnvironment
-
onException
Called to handle an unexpected exception.- Parameters:
t
- the Throwable
-
wrap
protected com.oracle.coherence.persistence.PersistenceManager wrap(com.oracle.coherence.persistence.PersistenceManager<R> mgr) Wrap the specified manager in a SafePersistenceManager implementation.- Parameters:
mgr
- the underlying PersistenceManger- Returns:
- a "safe" PersistenceManger or null if the specified manager is null
-
openBackup
Open and return a singleton PersistenceManager to store backup data.- Returns:
- the singleton backup PersistenceManager or null if an active PersistenceManager has not been configured
-
openEvents
Open and return a singleton PersistenceManager to store MapEvents.- Returns:
- the singleton store of MapEvents or null if durable events is not enabled
-
openActive
Open and return the singleton active PersistenceManager.- Specified by:
openActive
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
openActive
in classNullImplementation.NullPersistenceEnvironment<R>
- Returns:
- the singleton active PersistenceManager or null if an active PersistenceManager has not been configured
-
openSnapshot
Open a PersistenceManager used to access the snapshot with the specified identifier.- Specified by:
openSnapshot
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
openSnapshot
in classNullImplementation.NullPersistenceEnvironment<R>
- Parameters:
sSnapshot
- the snapshot identifier- Returns:
- a PersistenceManager representing the snapshot
-
createSnapshot
public com.oracle.coherence.persistence.PersistenceManager<R> createSnapshot(String sSnapshot, com.oracle.coherence.persistence.PersistenceManager<R> manager) Create a PersistenceManager used to manage the snapshot with the specified identifier.- Specified by:
createSnapshot
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
createSnapshot
in classNullImplementation.NullPersistenceEnvironment<R>
- Parameters:
sSnapshot
- the snapshot identifiermanager
- the optional PersistenceManager to create a snapshot of; if null, an empty snapshot will be created- Returns:
- a PersistenceManager representing the snapshot
-
removeSnapshot
Remove the persistent artifacts associated with the snapshot with the specified identifier.- Specified by:
removeSnapshot
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
removeSnapshot
in classNullImplementation.NullPersistenceEnvironment<R>
- Parameters:
sSnapshot
- the snapshot identifier- Returns:
- true if the snapshot was successfully deleted, false otherwise
-
listSnapshots
Return the identifiers of the snapshots known to this environment.- Specified by:
listSnapshots
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
listSnapshots
in classNullImplementation.NullPersistenceEnvironment<R>
- Returns:
- a list of the known snapshot identifiers
-
release
public void release()Release all resources held by this environment. Note that the behavior of all other methods on this environment is undefined after this method is called.- Specified by:
release
in interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>
- Overrides:
release
in classNullImplementation.NullPersistenceEnvironment<R>
-
toString
Return a human readable description of this SafePersistenceEnvironment.
-