ReplicaConsistencyException (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.je.rep

## Class ReplicaConsistencyException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - com.sleepycat.je.DatabaseException
        - - com.sleepycat.je.OperationFailureException
          - - com.sleepycat.je.rep.ReplicaConsistencyException

- All Implemented Interfaces:
    Serializable

      public class ReplicaConsistencyException
      extends OperationFailureException

  This exception is thrown by a Replica to indicate it could not meet the consistency requirements as defined by the `ReplicaConsistencyPolicy` in effect for the transaction, within the allowed timeout period.

  A Replica will typically keep current with its Master. However, network problems, excessive load on the Master, or Replica, may prevent the Replica from keeping up and the Replica may fall further behind than is permitted by its consistency policy. If the Replica cannot catch up in the time defined by its `ReplicaConsistencyPolicy`, it will throw this exception from the `Environment.beginTransaction` method, thus preventing the transaction from accessing data that does not meet its consistency requirements.

  If this exception is encountered frequently, it indicates that the consistency policy requirements are too strict and cannot be met routinely given the load being placed on the system and the hardware resources that are available to service the load. The exception may also indicate that there is a network related issue that is preventing the Replica from communicating with the master and keeping up with the replication stream.

  The application can choose to retry the transaction, until the underlying system problem has been resolved. Or it can try relaxing the consistency constraints, or choose the `NoConsistencyRequiredPolicy` so that the constraints can be satisfied more easily. For example, in a two node replication group, if the primary goes down, the application may want the secondary node to continue to service read requests, and will lower the consistency requirement on that node in order to maintain read availability.

  See Also:
    `ReplicaConsistencyPolicy`, Managing Consistency, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReplicaConsistencyException(String message, ReplicaConsistencyPolicy consistencyPolicy)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReplicaConsistencyPolicy` | `getConsistencyPolicy()` Returns the Replica consistency policy that could not be satisfied.

    - ### Methods inherited from class com.sleepycat.je.DatabaseException

      `getMessage`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ReplicaConsistencyException

          public ReplicaConsistencyException(String message,
                                     ReplicaConsistencyPolicy consistencyPolicy)

  - ### Method Detail

    - #### getConsistencyPolicy

          public ReplicaConsistencyPolicy getConsistencyPolicy()

      Returns the Replica consistency policy that could not be satisfied.
      Returns:
        the Replica consistency policy

Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.