Class Session


  • public class Session
    extends Object
    Holds properties of Consul sessions
    Author:
    Ruslan Sennov
    • Constructor Detail

      • Session

        public Session()
        Default constructor
      • Session

        public Session​(Session other)
        Copy constructor
        Parameters:
        other - the one to copy
      • Session

        public Session​(JsonObject session)
        Constructor from JSON
        Parameters:
        session - the JSON
    • Method Detail

      • toJson

        public JsonObject toJson()
        Convert to JSON
        Returns:
        the JSON
      • getLockDelay

        public long getLockDelay()
        Lock delay is a time duration, between 0 and 60 seconds. When a session invalidation takes place, Consul prevents any of the previously held locks from being re-acquired for the lock-delay interval. The default is 15s.
        Returns:
        the lock delay in seconds
      • getNode

        public String getNode()
        Get the ID of node
        Returns:
        the ID of node
      • getChecks

        public List<String> getChecks()
        Get the list of associated health checks
        Returns:
        the list of associated health checks
      • getId

        public String getId()
        Get the ID of session
        Returns:
        the ID of session
      • getCreateIndex

        public long getCreateIndex()
        Get the create index of session
        Returns:
        the create index of session
      • getIndex

        public long getIndex()
        Get Consul index
        Returns:
        the consul index
      • setLockDelay

        public Session setLockDelay​(long lockDelay)
        Set the Lock delay of session
        Parameters:
        lockDelay - the Lock delay of session
        Returns:
        reference to this, for fluency
      • setNode

        public Session setNode​(String node)
        Set the ID of node
        Parameters:
        node - the ID of node
        Returns:
        reference to this, for fluency
      • setChecks

        public Session setChecks​(List<String> checks)
        Set the list of associated health checks
        Parameters:
        checks - the list of associated health checks
        Returns:
        reference to this, for fluency
      • setCreateIndex

        public Session setCreateIndex​(long createIndex)
        Set the create index of session
        Parameters:
        createIndex - the create index of session
        Returns:
        reference to this, for fluency
      • setId

        public Session setId​(String id)
        Set the ID of node
        Parameters:
        id - the ID of node
        Returns:
        reference to this, for fluency
      • setIndex

        public Session setIndex​(long index)
        Set Consul index
        Parameters:
        index - the consul index
        Returns:
        reference to this, for fluency
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object