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
FieldsModifier 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
ConstructorsConstructorDescriptionSafePersistenceEnvironment(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 voidonException(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.voidrelease()Release all resources held by this environment.booleanremoveSnapshot(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.PersistenceManagerWrap the specified manager in a SafePersistenceManager implementation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
openActivein interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
openActivein 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:
openSnapshotin interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
openSnapshotin 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:
createSnapshotin interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
createSnapshotin 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:
removeSnapshotin interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
removeSnapshotin 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:
listSnapshotsin interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
listSnapshotsin 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:
releasein interfacecom.oracle.coherence.persistence.PersistenceEnvironment<R>- Overrides:
releasein classNullImplementation.NullPersistenceEnvironment<R>
-
toString
Return a human readable description of this SafePersistenceEnvironment.
-