Class ElectionCandidate.Null

java.lang.Object
io.deephaven.enterprise.etcdclient.election.ElectionCandidate.Null
All Implemented Interfaces:
ElectionCandidate
Enclosing interface:
ElectionCandidate

public static class ElectionCandidate.Null extends Object implements ElectionCandidate
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.deephaven.enterprise.etcdclient.election.ElectionCandidate

    ElectionCandidate.Null
  • Field Summary

    Fields inherited from interface io.deephaven.enterprise.etcdclient.election.ElectionCandidate

    NULL
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close this object.
    io.deephaven.shadow.jetcd.io.etcd.jetcd.ByteSequence
    Get the leadership opaque key associated to us having leadership, or null if we are not the leader.
    boolean
     
    boolean
    register(DhService service, int port)
    Register our address in DH Resolver.
    void
    Resign from this election and remove any DH Resolver registration.
    void
    setLostLeadershipCb(Runnable lostLeadershipCb)
    Set a new lost leadership callback, replacing the previously assigned one during construction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Null

      public Null()
  • Method Details

    • setLostLeadershipCb

      public void setLostLeadershipCb(Runnable lostLeadershipCb)
      Description copied from interface: ElectionCandidate
      Set a new lost leadership callback, replacing the previously assigned one during construction. Note that if at the time this call is made leadership is already lost, the callback will be invoked from inside this method activation.
      Specified by:
      setLostLeadershipCb in interface ElectionCandidate
      Parameters:
      lostLeadershipCb - a callback to run when leadership is lost.
    • register

      public boolean register(DhService service, int port)
      Description copied from interface: ElectionCandidate
      Register our address in DH Resolver. The registration is done as an etcd transaction conditional on our leadership key
      Specified by:
      register in interface ElectionCandidate
      Parameters:
      service - the service for the registration
      port - the port for the registration
      Returns:
      true if the registration succeeded in etcd, false otherwise, which implies leadership was lost.
    • isLeader

      public boolean isLeader()
      Specified by:
      isLeader in interface ElectionCandidate
      Returns:
      true if we are still the leader.
    • getLeadershipKey

      public io.deephaven.shadow.jetcd.io.etcd.jetcd.ByteSequence getLeadershipKey()
      Description copied from interface: ElectionCandidate
      Get the leadership opaque key associated to us having leadership, or null if we are not the leader. This key can be used transactionally to do other operations conditional on us still being the leader.
      Specified by:
      getLeadershipKey in interface ElectionCandidate
      Returns:
      the leadership key
    • resign

      public void resign()
      Description copied from interface: ElectionCandidate
      Resign from this election and remove any DH Resolver registration.
      Specified by:
      resign in interface ElectionCandidate
    • close

      public void close()
      Description copied from interface: ElectionCandidate
      Close this object. Implies resigning if already leader.
      Specified by:
      close in interface ElectionCandidate