Package akka.cluster

Class Reachability

  • All Implemented Interfaces:
    java.io.Serializable

    public class Reachability
    extends java.lang.Object
    implements java.io.Serializable
    INTERNAL API

    Immutable data structure that holds the reachability status of subject nodes as seen from observer nodes. Failure detector for the subject nodes exist on the observer nodes. Changes (reachable, unreachable, terminated) are only performed by observer nodes to its own records. Each change bumps the version number of the record, and thereby it is always possible to determine which record is newest when merging two instances.

    By default, each observer treats every other node as reachable. That allows to introduce the invariant that if an observer sees all nodes as reachable, no records should be kept at all. Therefore, in a running cluster with full reachability, no records need to be kept at all.

    Aggregated status of a subject node is defined as (in this order): - Terminated if any observer node considers it as Terminated - Unreachable if any observer node considers it as Unreachable - Reachable otherwise, i.e. no observer node considers it as Unreachable

    See Also:
    Serialized Form
    • Constructor Detail

      • Reachability

        public Reachability()
    • Method Detail

      • versions

        public scala.collection.immutable.Map<UniqueAddress,​java.lang.Object> versions()
      • isReachable

        public boolean isReachable​(UniqueAddress node)
        Returns:
        true if the given node is seen as Reachable, i.e. there's no negative (Unreachable, Terminated) observation record known for that the node.
      • isReachable

        public boolean isReachable​(UniqueAddress observer,
                                   UniqueAddress subject)
        Returns:
        true if the given observer node can reach the subject node.
      • isAllReachable

        public boolean isAllReachable()
        Returns:
        true if there's no negative (Unreachable, Terminated) observation record at all for any node
      • allUnreachable

        public scala.collection.immutable.Set<UniqueAddress> allUnreachable()
        Returns:
        all nodes that are Unreachable (i.e. they have been reported as Unreachable by at least one other node). This does not include nodes observed to be Terminated.
      • allUnreachableOrTerminated

        public scala.collection.immutable.Set<UniqueAddress> allUnreachableOrTerminated()
        Returns:
        all nodes that are Unreachable or Terminated (i.e. they have been reported as Unreachable or Terminated by at least one other node).
      • allUnreachableFrom

        public scala.collection.immutable.Set<UniqueAddress> allUnreachableFrom​(UniqueAddress observer)
        Returns:
        all nodes that have been observed as Unreachable by the given observer. This doesn't include nodes observed as Terminated.
      • observersGroupedByUnreachable

        public scala.collection.immutable.Map<UniqueAddress,​scala.collection.immutable.Set<UniqueAddress>> observersGroupedByUnreachable()
      • allObservers

        public scala.collection.immutable.Set<UniqueAddress> allObservers()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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