Class ClusterRegistry.Snapshot

java.lang.Object
org.openspaces.core.multicluster.internal.ClusterRegistry.Snapshot
Enclosing class:
ClusterRegistry

public static final class ClusterRegistry.Snapshot extends Object
An immutable view of the topology. Handed to routing code so a single operation sees one consistent picture even while failover happens.
  • Method Details

    • clusters

      public List<ClusterRegistry.Cluster> clusters()
    • isEmpty

      public boolean isEmpty()
    • size

      public int size()
    • find

    • findName

      public Optional<String> findName(GigaSpace proxy)
    • activeName

      public String activeName()
    • active

    • readActiveName

      public String readActiveName()
      The cluster READ_ACTIVE reads go to: the pinned read cluster if there is one, otherwise the active cluster. With no pin the two roles are one, which is the default and the only way to get read-your-writes.
    • readActive

      public Optional<ClusterRegistry.Cluster> readActive()
    • readActivePin

      public String readActivePin()
      The pinned read cluster, or null when reads follow the active cluster.
    • isReadActiveSplit

      public boolean isReadActiveSplit()
      Whether READ_ACTIVE reads currently go somewhere other than where mutations go.
    • priorityList

      public List<String> priorityList()
      The priority list exactly as configured; empty means "registration order".
    • readRotation

      public List<String> readRotation()
      Clusters eligible for round-robin reads, in registration order.

      Registering a cluster puts it in, and only an explicit ClusterRegistry.removeFromReadRotation(String) takes it out - a cluster that fails is reported rather than removed, and what becomes of it is the application's call. Membership is not availability: the rotation says where a cluster belongs, and health decides whether it is currently worth sending traffic to, so a cluster can be in the rotation and skipped by every read. It governs READ_ROUND_ROBIN reads only: the active cluster keeps serving READ_ACTIVE reads, local calls and mutations even when it is out of the rotation, because otherwise removing it would silently stop all reads.

    • isInReadRotation

      public boolean isInReadRotation(String name)
      Whether this cluster may serve round-robin reads.
    • isPromotable

      public boolean isPromotable(String name)
      Whether this cluster may be promoted to active.
    • failoverOrder

      public List<String> failoverOrder()
      Failover order: configured priorities first, then any registered cluster the list omits, in registration order - so failover is never stranded by a partial configuration.

      A cluster explicitly removed from the priority list is a different thing from one that was simply never listed, and is left out entirely. Without that distinction a cluster dropped on failure would be re-elected as active by the very next promotion, which is exactly what removing it was meant to prevent.

    • asProxyMap

      public Map<String, GigaSpace> asProxyMap()
      Name to proxy, in registration order.
    • toString

      public String toString()
      Overrides:
      toString in class Object