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

com.sleepycat.je.rep

## Class InsufficientAcksException

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

- All Implemented Interfaces:
    Serializable

      public class InsufficientAcksException
      extends OperationFailureException

  This exception is thrown at the time of a commit in a Master, if the Master could not obtain transaction commit acknowledgments from its Replicas in accordance with the `Durability.ReplicaAckPolicy` currently in effect and within the requested timeout interval. This exception will never be thrown when the `ReplicaAckPolicy` of `NONE` is in effect.

  Note that an `InsufficientAcksException` means the transaction has already committed at the master. The transaction may also have been committed at one or more Replicas, but the lack of replica acknowledgments means that the number of replicas that committed could not be established. If the transaction was in fact committed by less than a simple majority of the nodes, it could result in a `RollbackException` when the node subsequently attempts to rejoin the group as a Replica.

  The application can handle the exception and choose to respond in a number of ways. For example, it can

  - do nothing, assuming that the transaction will eventually propagate to enough replicas to become durable,
  - retry the operation in a new transaction, which may succeed or fail depending on whether the underlying problems have been resolved,
  - retry using a larger timeout interval and return to the original timeout interval at a later time,
  - fall back temporarily to a read-only mode,
  - increase the durability of the transaction on the Master by ensuring that the changes are flushed to the operating system's buffers or to the disk, or
  - give up and report an error at a higher level, perhaps to allow an administrator to check the underlying cause of the failure.
  See Also:
    `Durability`, Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `acksPending()` It returns the number of Replicas that did not respond with an acknowledgment within the Replica commit timeout period.
    `int` | `acksRequired()` It returns the number of acknowledgments required by the commit policy.
    `int` | `ackTimeout()` Returns the acknowledgment timeout that was in effect at the time of the exception.

    - ### 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`

- - ### Method Detail

    - #### acksPending

          public int acksPending()

      It returns the number of Replicas that did not respond with an acknowledgment within the Replica commit timeout period.
      Returns:
        the number of missing acknowledgments

    - #### acksRequired

          public int acksRequired()

      It returns the number of acknowledgments required by the commit policy.
      Returns:
        the number of acknowledgments required

    - #### ackTimeout

          public int ackTimeout()

      Returns the acknowledgment timeout that was in effect at the time of the exception.
      Returns:
        the acknowledgment timeout in milliseconds

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