Class CuratorDruidLeaderSelector

    • Constructor Detail

      • CuratorDruidLeaderSelector

        public CuratorDruidLeaderSelector​(org.apache.curator.framework.CuratorFramework curator,
                                          DruidNode self,
                                          String latchPath)
    • Method Detail

      • getCurrentLeader

        @Nullable
        public String getCurrentLeader()
        Description copied from interface: DruidLeaderSelector
        Get ID of current Leader. Returns NULL if it can't find the leader. Note that it is possible for leadership to change right after this call returns, so caller would get wrong leader. This is expected to work even if a listener is not registered.
        Specified by:
        getCurrentLeader in interface DruidLeaderSelector
      • isLeader

        public boolean isLeader()
        Description copied from interface: DruidLeaderSelector
        Returns true if this node is elected leader from underlying system's point of view. For example if curator is used to implement this then true would be returned when curator believes this node to be the leader. Note that it is possible for leadership to change right after this call returns, so caller would get wrong status.
        Specified by:
        isLeader in interface DruidLeaderSelector
      • localTerm

        public int localTerm()
        Description copied from interface: DruidLeaderSelector
        Implementation would increment it everytime it becomes leader. This allows users to start a long running task when they become leader and be able to intermittently check that they are still leader from same term when they started. DruidCoordinator class uses it to do intermittent checks and stop the activity as needed.
        Specified by:
        localTerm in interface DruidLeaderSelector