Interface ClusterAcceptor


  • public interface ClusterAcceptor
    Cluster join acceptor.

    Implementations of this interface can provide a custom logic of accepting/rejecting new nodes when they are trying to join the cluster.

    When a new node tries to join the cluster it sends a join request to an existing cluster node. When the node receives such a request it asks all of its registered acceptors to check for the validity of the joining node by calling the acceptJoin(ClusterNode, Hekate) method. If any acceptor returns a non-null reject reason then the joining node will be rejected and the ClusterRejectedJoinException will be thrown on its side. Information about the reject reason can be obtained via the ClusterRejectedJoinException.rejectReason() method.

    Instances of this interface can be registered via the ClusterServiceFactory.setAcceptors(List) method. Note that the same implementation of this interface must be registered on all of the cluster nodes, since any of them can be selected by the joining node as a join target.

    See Also:
    ClusterServiceFactory.setAcceptors(List)
    • Method Detail

      • acceptJoin

        String acceptJoin​(ClusterNode joining,
                          Hekate local)
        Called when a new node tries to join the cluster. Returns null if new node should be accepted or an arbitrary string indicating the reject reason.
        Parameters:
        joining - New node that is trying to join the cluster.
        local - Hekate instance that this acceptor belongs to.
        Returns:
        Reject reason if node should be rejected or null if node should be accepted.