Transaction.State (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.je

## Enum Transaction.State

- java.lang.Object
- - java.lang.Enum<Transaction.State>
  - - com.sleepycat.je.Transaction.State

- All Implemented Interfaces:
    Serializable, Comparable<Transaction.State>
  Enclosing class:
    Transaction

      public static enum Transaction.State
      extends Enum<Transaction.State>

  The current state of the transaction.
  Since:
    5.0.48

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ABORTED` The transaction has been aborted.
    `COMMITTED` The transaction has been committed and is locally durable according to the `local SyncPolicy` requested.
    `MUST_ABORT` The transaction has been invalidated by an exception and cannot be committed.
    `OPEN` The transaction has not been committed or aborted, and can be used for performing operations.
    `POSSIBLY_COMMITTED` An exception was thrown by the `commit` method due to an error that occurred while attempting to make the transaction durable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Transaction.State` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static Transaction.State[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### OPEN

          public static final Transaction.State OPEN

      The transaction has not been committed or aborted, and can be used for performing operations. This state is also indicated if `Transaction.isValid()` returns true. For all other states, `Transaction.isValid()` will return false.

    - #### POSSIBLY_COMMITTED

          public static final Transaction.State POSSIBLY_COMMITTED

      An exception was thrown by the `commit` method due to an error that occurred while attempting to make the transaction durable. The transaction may or may not be locally durable, according to the `local SyncPolicy` requested.

      This is an unusual situation and is normally due to a system failure, storage device failure, disk full condition, thread interrupt, or a bug of some kind. When a transaction is in this state, the Environment will have been `invalidated` by the error.

      In a replicated environment, a transaction in this state is not transferred to replicas. If it turns out that the transaction is indeed durable, it will be transferred to replicas via normal replication mechanisms when the Environment is re-opened.

      When the `commit` method throws an exception and the transaction is in the `POSSIBLY_COMMITTED` state, some applications may wish to perform a data query to determine whether the transaction is durable or not. Note that in the event of a system level failure, the reads themselves may be unreliable, e.g. the data may be in the file system cache but not on disk. Other applications may wish to repeat the transaction unconditionally, after resolving the error condition, particularly when the set of operations in the transaction is designed to be idempotent.

    - #### COMMITTED

          public static final Transaction.State COMMITTED

      The transaction has been committed and is locally durable according to the `local SyncPolicy` requested.

      Note that a transaction may be in this state even when an exception is thrown by the `commit` method. For example, in a replicated environment, an `InsufficientAcksException` may be thrown after the transaction is committed locally.

    - #### MUST_ABORT

          public static final Transaction.State MUST_ABORT

      The transaction has been invalidated by an exception and cannot be committed. See `OperationFailureException` for a description of how a transaction can become invalid. The application is responsible for aborting the transaction.

    - #### ABORTED

          public static final Transaction.State ABORTED

      The transaction has been aborted.

  - ### Method Detail

    - #### values

          public static Transaction.State[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (Transaction.State c : Transaction.State.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static Transaction.State valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

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