Record Class ClusterHealth.Transition
java.lang.Object
java.lang.Record
org.openspaces.core.multicluster.internal.health.ClusterHealth.Transition
- Enclosing class:
ClusterHealth
public static record ClusterHealth.Transition(ClusterHealth.State from, ClusterHealth.State to)
extends Record
A state change, captured atomically.
It exists because "read the state, mutate it, compare" is not safe across three separate calls:
two threads failing the same cluster at the same moment can each observe the same from and
the same to, and each conclude that they caused the transition - which fires every
downstream listener twice. Computing both ends inside one lock makes exactly one caller see a change.
-
Constructor Summary
ConstructorsConstructorDescriptionTransition(ClusterHealth.State from, ClusterHealth.State to) Creates an instance of aTransitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchanged()final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Transition
Creates an instance of aTransitionrecord class.- Parameters:
from- the value for thefromrecord componentto- the value for thetorecord component
-
-
Method Details
-
changed
public boolean changed() -
toString
-
hashCode
-
equals
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. All components in this record class are compared withObjects::equals(Object,Object). -
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-