Record Class ClusterEvent

java.lang.Object
java.lang.Record
org.openspaces.core.multicluster.event.ClusterEvent
Record Components:
type - what happened
clusterName - the cluster the event is about; for ClusterEventType.ACTIVE_CLUSTER_CHANGED and ClusterEventType.READ_ACTIVE_CLUSTER_CHANGED this is the cluster that now holds the role
clusterProxy - that cluster's proxy, or null if it has been unregistered
previousActive - the cluster that held the role before, set only for the two role-change events
cause - the failure behind the event, or null when it was deliberate
inReadRotation - whether the cluster is in the read rotation after this event
promotable - whether the cluster may be promoted to active after this event

public record ClusterEvent(ClusterEventType type, String clusterName, GigaSpace clusterProxy, String previousActive, Throwable cause, boolean inReadRotation, boolean promotable) extends Record
What changed in the topology, and why.
  • Constructor Details

    • ClusterEvent

      public ClusterEvent(ClusterEventType type, String clusterName, GigaSpace clusterProxy, String previousActive, Throwable cause, boolean inReadRotation, boolean promotable)
      Creates an instance of a ClusterEvent record class.
      Parameters:
      type - the value for the type record component
      clusterName - the value for the clusterName record component
      clusterProxy - the value for the clusterProxy record component
      previousActive - the value for the previousActive record component
      cause - the value for the cause record component
      inReadRotation - the value for the inReadRotation record component
      promotable - the value for the promotable record component
  • Method Details

    • added

      public static ClusterEvent added(String clusterName, GigaSpace proxy)
    • removed

      public static ClusterEvent removed(String clusterName, GigaSpace proxy)
    • failed

      public static ClusterEvent failed(String clusterName, GigaSpace proxy, Throwable cause)
      A cluster left the rotation and the priority list because it failed.
    • failed

      public static ClusterEvent failed(String clusterName, GigaSpace proxy, Throwable cause, boolean inReadRotation, boolean promotable)
      A cluster failed, reporting where that leaves it.

      Most modes no longer detach a cluster that could not be reached - they say so and leave the decision to the application - so the membership flags have to describe the cluster as it actually is. Reporting a cluster still serving reads as out of the rotation would tell the listener the opposite of the truth, and the listener is the one deciding whether to remove it.

    • activeChanged

      public static ClusterEvent activeChanged(String previousActive, String newActive, GigaSpace newProxy, Throwable cause)
    • readActiveChanged

      public static ClusterEvent readActiveChanged(String previous, String current, GigaSpace currentProxy, Throwable cause)
      The cluster serving READ_ACTIVE reads changed from previous to current.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public ClusterEventType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • clusterName

      public String clusterName()
      Returns the value of the clusterName record component.
      Returns:
      the value of the clusterName record component
    • clusterProxy

      public GigaSpace clusterProxy()
      Returns the value of the clusterProxy record component.
      Returns:
      the value of the clusterProxy record component
    • previousActive

      public String previousActive()
      Returns the value of the previousActive record component.
      Returns:
      the value of the previousActive record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component
    • inReadRotation

      public boolean inReadRotation()
      Returns the value of the inReadRotation record component.
      Returns:
      the value of the inReadRotation record component
    • promotable

      public boolean promotable()
      Returns the value of the promotable record component.
      Returns:
      the value of the promotable record component