public class SessionOptions extends Object
Constructor and Description |
---|
SessionOptions()
Default constructor
|
SessionOptions(JsonObject options)
Constructor from JSON
|
SessionOptions(SessionOptions options)
Copy constructor
|
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
|
public SessionOptions()
public SessionOptions(SessionOptions options)
options
- the one to copypublic SessionOptions(JsonObject options)
options
- the JSONpublic JsonObject toJson()
public long getLockDelay()
Session.getLockDelay()
public SessionOptions setLockDelay(long lockDelay)
lockDelay
- the lock-delay period in secondsSession.getLockDelay()
public String getName()
public SessionOptions setName(String name)
name
- the name of sessionpublic String getNode()
public SessionOptions setNode(String node)
node
- the ID of nodepublic List<String> getChecks()
setChecks(List)
public SessionOptions setChecks(List<String> checks)
checks
- list of associated health checkspublic SessionBehavior getBehavior()
setBehavior(SessionBehavior)
public SessionOptions setBehavior(SessionBehavior behavior)
behavior
- the session behaviorpublic long getTtl()
setTtl(long)
public SessionOptions setTtl(long ttl)
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.ttl
- the TTL interval in secondsCopyright © 2024 Eclipse. All rights reserved.