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 representation
T - 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

    Fields
    Modifier and Type
    Field
    Description
    protected final Continuation<? super T>
    The failure continuation for this environment.
    protected final com.oracle.coherence.persistence.PersistenceEnvironment<R>
    The underlying PersistenceEnvironment.
    The FailureContinuationFactory.

    Fields inherited from class com.tangosol.util.NullImplementation.NullPersistenceEnvironment

    INSTANCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    SafePersistenceEnvironment(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 Type
    Method
    Description
    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.
    com.oracle.coherence.persistence.PersistenceEnvironment<R>
    Return the underlying PersistenceEnvironment.
    Return the identifiers of the snapshots known to this environment.
    protected void
    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 all resources held by this environment.
    boolean
    Remove the persistent artifacts associated with the snapshot with the specified identifier.
    Return a human readable description of this SafePersistenceEnvironment.
    protected com.oracle.coherence.persistence.PersistenceManager
    wrap(com.oracle.coherence.persistence.PersistenceManager<R> mgr)
    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

      protected final com.oracle.coherence.persistence.PersistenceEnvironment<R> f_env
      The underlying PersistenceEnvironment.
    • f_contFailure

      protected final Continuation<? super T extends Throwable> f_contFailure
      The failure continuation for this environment.
    • f_factoryCont

      protected final SafePersistenceWrappers.FailureContinuationFactory<R,? super T extends Throwable> f_factoryCont
      The FailureContinuationFactory.
  • Constructor Details

    • SafePersistenceEnvironment

      public SafePersistenceEnvironment(com.oracle.coherence.persistence.PersistenceEnvironment<R> env)
      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 PersistenceEnvironment
      cont - 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 PersistenceEnvironment
      factory - the failure continuation factory to use to create handlers for unexpected exceptions
  • Method Details

    • getEnvironment

      public com.oracle.coherence.persistence.PersistenceEnvironment<R> getEnvironment()
      Return the underlying PersistenceEnvironment.
      Returns:
      the underlying PersistenceEnvironment
    • onException

      protected void onException(T t)
      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

      public com.oracle.coherence.persistence.PersistenceManager<R> 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

      public com.oracle.coherence.persistence.PersistenceManager<R> 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

      public com.oracle.coherence.persistence.PersistenceManager<R> openActive()
      Open and return the singleton active PersistenceManager.
      Specified by:
      openActive in interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      openActive in class NullImplementation.NullPersistenceEnvironment<R>
      Returns:
      the singleton active PersistenceManager or null if an active PersistenceManager has not been configured
    • openSnapshot

      public com.oracle.coherence.persistence.PersistenceManager<R> openSnapshot(String sSnapshot)
      Open a PersistenceManager used to access the snapshot with the specified identifier.
      Specified by:
      openSnapshot in interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      openSnapshot in class NullImplementation.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 interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      createSnapshot in class NullImplementation.NullPersistenceEnvironment<R>
      Parameters:
      sSnapshot -  the snapshot identifier
      manager - the optional PersistenceManager to create a snapshot of; if null, an empty snapshot will be created
      Returns:
      a PersistenceManager representing the snapshot
    • removeSnapshot

      public boolean removeSnapshot(String sSnapshot)
      Remove the persistent artifacts associated with the snapshot with the specified identifier.
      Specified by:
      removeSnapshot in interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      removeSnapshot in class NullImplementation.NullPersistenceEnvironment<R>
      Parameters:
      sSnapshot -  the snapshot identifier
      Returns:
      true if the snapshot was successfully deleted, false otherwise
    • listSnapshots

      public String[] listSnapshots()
      Return the identifiers of the snapshots known to this environment.
      Specified by:
      listSnapshots in interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      listSnapshots in class NullImplementation.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 interface com.oracle.coherence.persistence.PersistenceEnvironment<R>
      Overrides:
      release in class NullImplementation.NullPersistenceEnvironment<R>
    • toString

      public String toString()
      Return a human readable description of this SafePersistenceEnvironment.
      Overrides:
      toString in class Object
      Returns:
      a human readable description