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

com.sleepycat.je.rep.monitor

## Class MonitorConfig

- java.lang.Object
- - com.sleepycat.je.rep.monitor.MonitorConfig

- All Implemented Interfaces:
    Cloneable

      public class MonitorConfig
      extends Object
      implements Cloneable

  Specifies the attributes used by a replication `Monitor`.

  The following properties identify the target group.

  - groupName: the name of the replication group being monitored.
  - nodeName: the group-wide unique name associated with this monitor node.
  - nodeHost: the hostname and port associated with this Monitor. Used by group members to contact the Monitor.
  - helperHosts: the list of replication nodes which the Monitor uses to register itself so it can receive notifications about group status changes.
  The following properties configure the daemon ping thread implemented within the Monitor. This daemon thread lets the Monitor proactively find status changes that occur when the Monitor is down or has lost network connectivity.
  - numRetries: number of times the ping thread attempts to contact a node before deeming is unreachable.
  - retryInterval: number of milliseconds between ping thread retries.
  - timeout: socketConnection timeout, in milliseconds, specified when the ping thread attempts to establish a connection with a replication node.
  Since:
    JE 5.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static MonitorConfig` | `DEFAULT` An instance created using the default constructor is initialized with the default settings.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MonitorConfig()` An instance created using the default constructor is initialized with the default settings.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MonitorConfig` | `clone()` Returns a copy of this configuration object.
    `String` | `getGroupName()` Gets the name associated with the replication group.
    `String` | `getHelperHosts()` Returns the string identifying one or more helper host and port pairs in this format:
    `String` | `getNodeHostname()` Returns the hostname component of the nodeHost property.
    `String` | `getNodeHostPort()` Returns the hostname and port associated with this node.
    `String` | `getNodeName()` Returns the unique name associated with this monitor.
    `int` | `getNodePort()` Returns the port component of the nodeHost property.
    `int` | `getNumRetries()` Returns the number of times a ping thread attempts to contact a node before deeming it unreachable.
    `long` | `getRetryInterval()` Returns the number of milliseconds between ping thread retries.
    `int` | `getSocketConnectTimeout()` Returns the socketConnection timeout, in milliseconds, used when the ping thread attempts to establish a connection with a replication node.
    `MonitorConfig` | `setGroupName(String groupName)` Sets the name for the replication group.
    `MonitorConfig` | `setHelperHosts(String helperHosts)` Identify one or more helpers nodes by their host and port pairs in this format:
    `MonitorConfig` | `setNodeHostPort(String hostPort)` Sets the hostname and port associated with this monitor.
    `MonitorConfig` | `setNodeName(String nodeName)` Sets the name to be associated with this `monitor`.
    `MonitorConfig` | `setNumRetries(int numRetries)` Sets the number of times a ping thread attempts to contact a node before deeming it unreachable.
    `MonitorConfig` | `setRetryInterval(long retryInterval)` Sets the number of milliseconds between ping thread retries.
    `MonitorConfig` | `setSocketConnectTimeout(int socketConnectTimeout)` Sets the socketConnection timeout, in milliseconds, used when the ping thread attempts to establish a connection with a replication node.

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

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

- - ### Field Detail

    - #### DEFAULT

          public static final MonitorConfig DEFAULT

      An instance created using the default constructor is initialized with the default settings.

  - ### Constructor Detail

    - #### MonitorConfig

          public MonitorConfig()

      An instance created using the default constructor is initialized with the default settings.

  - ### Method Detail

    - #### setGroupName

          public MonitorConfig setGroupName(String groupName)
                                     throws IllegalArgumentException

      Sets the name for the replication group. The name must be made up of just alpha numeric characters and must not be zero length.
      Parameters:
        `groupName` - the alpha numeric string representing the name.
      Throws:
        `IllegalArgumentException` - if the string name is not valid.

    - #### getGroupName

          public String getGroupName()

      Gets the name associated with the replication group.
      Returns:
        the name of this replication group.

    - #### setNodeName

          public MonitorConfig setNodeName(String nodeName)
                                    throws IllegalArgumentException

      Sets the name to be associated with this `monitor`. It must be unique within the group. When the `monitor` is instantiated and joins the replication group, a check is done to ensure that the name is unique, and a `RestartRequiredException` is thrown if it is not.
      Parameters:
        `nodeName` - the name of this monitor.
      Throws:
        `IllegalArgumentException`

    - #### getNodeName

          public String getNodeName()

      Returns the unique name associated with this monitor.
      Returns:
        the monitor name

    - #### setNodeHostPort

          public MonitorConfig setNodeHostPort(String hostPort)

      Sets the hostname and port associated with this monitor. The hostname and port combination are denoted by a string of the form:

            hostname[:port]

      The port must be outside the range of "Well Known Ports" (zero through 1023).
      Parameters:
        `hostPort` - the string containing the hostname and port as above.

    - #### getNodeHostPort

          public String getNodeHostPort()

      Returns the hostname and port associated with this node. The hostname and port combination are denoted by a string of the form:

            hostname:port

      Returns:
        the hostname and port string of this monitor.

    - #### setHelperHosts

          public MonitorConfig setHelperHosts(String helperHosts)

      Identify one or more helpers nodes by their host and port pairs in this format:

           hostname[:port][,hostname[:port]]*

      Parameters:
        `helperHosts` - the string representing the host and port pairs.

    - #### getHelperHosts

          public String getHelperHosts()

      Returns the string identifying one or more helper host and port pairs in this format:

           hostname[:port][,hostname[:port]]*

      Returns:
        the string representing the host port pairs.

    - #### getNodeHostname

          public String getNodeHostname()

      Returns the hostname component of the nodeHost property.
      Returns:
        the hostname string

    - #### getNodePort

          public int getNodePort()

      Returns the port component of the nodeHost property.
      Returns:
        the port number

    - #### setNumRetries

          public MonitorConfig setNumRetries(int numRetries)

      Sets the number of times a ping thread attempts to contact a node before deeming it unreachable. The default value is 5.

    - #### getNumRetries

          public int getNumRetries()

      Returns the number of times a ping thread attempts to contact a node before deeming it unreachable.

    - #### setRetryInterval

          public MonitorConfig setRetryInterval(long retryInterval)

      Sets the number of milliseconds between ping thread retries. The default value is 1000.

    - #### getRetryInterval

          public long getRetryInterval()

      Returns the number of milliseconds between ping thread retries.

    - #### setSocketConnectTimeout

          public MonitorConfig setSocketConnectTimeout(int socketConnectTimeout)

      Sets the socketConnection timeout, in milliseconds, used when the ping thread attempts to establish a connection with a replication node. The default value is 10,000.

    - #### getSocketConnectTimeout

          public int getSocketConnectTimeout()

      Returns the socketConnection timeout, in milliseconds, used when the ping thread attempts to establish a connection with a replication node.

    - #### clone

          public MonitorConfig clone()

      Returns a copy of this configuration object.
      Overrides:
        `clone` in class `Object`

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