Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 4.0.103
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD

## com.sleepycat.je.rep
Enum ReplicatedEnvironment.State

    java.lang.Object
      java.lang.Enum<ReplicatedEnvironment.State>
          com.sleepycat.je.rep.ReplicatedEnvironment.State

All Implemented Interfaces:
  Serializable, Comparable<ReplicatedEnvironment.State>

Enclosing class:
  ReplicatedEnvironment

    public static enum ReplicatedEnvironment.State

extends Enum<ReplicatedEnvironment.State>

The replication node state determines the operations that the application can perform against its replicated environment. The method `ReplicatedEnvironment.getState()` returns the current state.

When the first handle to a `ReplicatedEnvironment` is instantiated and the node is bought up, it always starts out in the `DETACHED` state and then transitions to the `MASTER` or `REPLICA` state before returning from the constructor.

When nodes in the group become unavailable and elections are held, the node may transition between `MASTER` and `REPLICA` states.

When the last handle to the environment is closed, the node transitions back to the `DETACHED` state.

The state transitions for a node can be summarized by the regular expression:

> `DETACHED [ MASTER | REPLICA | UNKNOWN ]+ DETACHED`, with the following caveats:

- A `MASTER` state never follows a `MASTER` state, since that would represent a redundant transition.
- Similarly, an `UNKNOWN` state never follows an `UNKNOWN` state, since that would be redundant transition.
- A `REPLICA` state can follow a `REPLICA` state, as long as this node is not the `MASTER`.

The initial `DETACHED` state is internal to the JE HA implementation and is not visible to the application.

Enum Constant Summary
`DETACHED` The node is not associated with the group.
`MASTER` The node is the unique master of the group and can both read and write to its environment.
`REPLICA` The node is a replica that is being updated by the master.
`UNKNOWN` The node is not currently in contact with its group, but is actively trying to establish contact and decide upon a master.

Method Summary
`boolean` | `isActive()`
`boolean` | `isDetached()`
`boolean` | `isMaster()`
`boolean` | `isReplica()`
`boolean` | `isUnknown()`
`static ReplicatedEnvironment.State` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
`static ReplicatedEnvironment.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

### DETACHED

    public static final ReplicatedEnvironment.State DETACHED

  The node is not associated with the group. Its handle has been closed. No operations can be performed on the environment when it is in this state.

### UNKNOWN

    public static final ReplicatedEnvironment.State UNKNOWN

  The node is not currently in contact with its group, but is actively trying to establish contact and decide upon a master. While in this state the node is restricted to performing just read operations on its environment. In a functioning group, this state is transitory.

### MASTER

    public static final ReplicatedEnvironment.State MASTER

  The node is the unique master of the group and can both read and write to its environment. When the node transitions to the state, the application running on the node must make provisions to start processing application level write requests in addition to read requests.

### REPLICA

    public static final ReplicatedEnvironment.State REPLICA

  The node is a replica that is being updated by the master. It is restricted to reading its environment. When the node transitions to this state, the application running on the node must make provisions to ensure that it does not write to the environment. It must arrange for all write requests to be routed to the master.

Method Detail

### values

    public static ReplicatedEnvironment.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 (ReplicatedEnvironment.State c : ReplicatedEnvironment.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 ReplicatedEnvironment.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

### isMaster

    public final boolean isMaster()

  Returns:
    true if the node is a Master when in this state

### isReplica

    public final boolean isReplica()

  Returns:
    true if the node is a Replica when in this state

### isDetached

    public final boolean isDetached()

  Returns:
    true if the node is disconnected from the replication group when in this state.

### isUnknown

    public final boolean isUnknown()

  Returns:
    true if the node's state is unknown, and it is attempting to transition to Master or Replica.

### isActive

    public final boolean isActive()

  Returns:
    true if the node is currently participating in the group as a Replica or a Master

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 4.0.103
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD

Copyright (c) 2004-2010 Oracle. All rights reserved.