Class AuditorElector


  • @StatsDoc(name="auditor",
              help="Auditor related stats")
    public class AuditorElector
    extends java.lang.Object
    Performing auditor election using Apache ZooKeeper. Using ZooKeeper as a coordination service, when a bookie bids for auditor, it creates an ephemeral sequential file (znode) on ZooKeeper and considered as their vote. Vote format is 'V_sequencenumber'. Election will be done by comparing the ephemeral sequential numbers and the bookie which has created the least znode will be elected as Auditor. All the other bookies will be watching on their predecessor znode according to the ephemeral sequence numbers.
    • Field Detail

      • shutdownTask

        java.lang.Runnable shutdownTask
    • Method Detail

      • start

        public java.util.concurrent.Future<?> start()
      • submitElectionTask

        java.util.concurrent.Future<?> submitElectionTask()
        Performing the auditor election using the ZooKeeper ephemeral sequential znode. The bookie which has created the least sequential will be elect as Auditor.
      • getCurrentAuditor

        public BookieId getCurrentAuditor()
                                   throws java.io.IOException,
                                          java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • shutdown

        public void shutdown()
                      throws java.lang.InterruptedException
        Shutting down AuditorElector.
        Throws:
        java.lang.InterruptedException
      • isRunning

        public boolean isRunning()
        If current bookie is running as auditor, return the status of the auditor. Otherwise return the status of elector.
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object