io.vertx.ext.consul

## Class SessionOptions

- java.lang.Object
- - io.vertx.ext.consul.SessionOptions

-     public class SessionOptions
      extends Object

  Options used to create session.
  Author:
    Ruslan Sennov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionOptions()` Default constructor
    `SessionOptions(JsonObject options)` Constructor from JSON
    `SessionOptions(SessionOptions options)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SessionBehavior` | `getBehavior()` Get the behavior when a session is invalidated.
    `List<String>` | `getChecks()` Get a list of associated health checks.
    `long` | `getLockDelay()` Get the lock-delay period.
    `String` | `getName()` Get the human-readable name for the Session
    `String` | `getNode()` Get the node to which the session will be assigned
    `long` | `getTtl()` Get the TTL interval.
    `SessionOptions` | `setBehavior(SessionBehavior behavior)` Set the behavior when a session is invalidated.
    `SessionOptions` | `setChecks(List<String> checks)` Set a list of associated health checks.
    `SessionOptions` | `setLockDelay(long lockDelay)` Set the lock-delay period.
    `SessionOptions` | `setName(String name)` Set the human-readable name for the Session
    `SessionOptions` | `setNode(String node)` Set the node to which the session will be assigned
    `SessionOptions` | `setTtl(long ttl)` Set the TTL interval.
    `JsonObject` | `toJson()` Convert to JSON

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

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

- - ### Constructor Detail

    - #### SessionOptions

          public SessionOptions()

      Default constructor

    - #### SessionOptions

          public SessionOptions(SessionOptions options)

      Copy constructor
      Parameters:
        `options` - the one to copy

    - #### SessionOptions

          public SessionOptions(JsonObject options)

      Constructor from JSON
      Parameters:
        `options` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### getLockDelay

          public long getLockDelay()

      Get the lock-delay period.
      Returns:
        the lock-delay period
      See Also:
        `Session.getLockDelay()`

    - #### setLockDelay

          public SessionOptions setLockDelay(long lockDelay)

      Set the lock-delay period.
      Parameters:
        `lockDelay` - the lock-delay period in seconds
      Returns:
        reference to this, for fluency
      See Also:
        `Session.getLockDelay()`

    - #### getName

          public String getName()

      Get the human-readable name for the Session
      Returns:
        the name of session

    - #### setName

          public SessionOptions setName(String name)

      Set the human-readable name for the Session
      Parameters:
        `name` - the name of session
      Returns:
        reference to this, for fluency

    - #### getNode

          public String getNode()

      Get the node to which the session will be assigned
      Returns:
        the ID of node

    - #### setNode

          public SessionOptions setNode(String node)

      Set the node to which the session will be assigned
      Parameters:
        `node` - the ID of node
      Returns:
        reference to this, for fluency

    - #### getChecks

          public List<String> getChecks()

      Get a list of associated health checks.
      Returns:
        list of associated health checks
      See Also:
        `setChecks(List)`

    - #### setChecks

          public SessionOptions setChecks(List<String> checks)

      Set a list of associated health checks. It is highly recommended that, if you override this list, you include the default "serfHealth"
      Parameters:
        `checks` - list of associated health checks
      Returns:
        reference to this, for fluency

    - #### getBehavior

          public SessionBehavior getBehavior()

      Get the behavior when a session is invalidated.
      Returns:
        the session behavior
      See Also:
        `setBehavior(SessionBehavior)`

    - #### setBehavior

          public SessionOptions setBehavior(SessionBehavior behavior)

      Set the behavior when a session is invalidated. The release behavior is the default if none is specified.
      Parameters:
        `behavior` - the session behavior
      Returns:
        reference to this, for fluency

    - #### getTtl

          public long getTtl()

      Get the TTL interval.
      Returns:
        the TTL interval in seconds
      See Also:
        `setTtl(long)`

    - #### setTtl

          public SessionOptions setTtl(long ttl)

      Set the TTL interval. When TTL interval expires without being renewed, the session has expired and an invalidation is triggered. If specified, it must be between `10s` and `86400s` currently. The contract of a TTL is that it represents a lower bound for invalidation; that is, Consul will not expire the session before the TTL is reached, but it is allowed to delay the expiration past the TTL. The lowest practical TTL should be used to keep the number of managed sessions low. When locks are forcibly expired, such as during a leader election, sessions may not be reaped for up to double this TTL, so long TTL values (> 1 hour) should be avoided.
      Parameters:
        `ttl` - the TTL interval in seconds
      Returns:
        reference to this, for fluency

Copyright © 2023 Eclipse. All rights reserved.