Package org.mockserver.state
Record Class ClusterInfo
java.lang.Object
java.lang.Record
org.mockserver.state.ClusterInfo
- Record Components:
clustered- whether this node participates in a multi-node clusternodeId- this node's unique idcoordinator- the id/address of the cluster coordinator, or this node's id when not clusteredclusterName- the configured cluster name, ornull/empty when not clusteredmembers- the cluster members; never empty (always contains at least this node)
public record ClusterInfo(boolean clustered, String nodeId, String coordinator, String clusterName, List<ClusterInfo.Member> members)
extends Record
Immutable snapshot of cluster membership and health for the
GET /mockserver/cluster operability endpoint.
For a single-node / in-memory deployment this is a degenerate snapshot:
clustered=false, exactly one member (this node), and
coordinator equal to this node's id. A clustered backend
(e.g. Infinispan with JGroups) reports the real fleet membership and the
elected coordinator.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionClusterInfo(boolean clustered, String nodeId, String coordinator, String clusterName, List<ClusterInfo.Member> members) Creates an instance of aClusterInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theclusteredrecord component.Returns the value of theclusterNamerecord component.Returns the value of thecoordinatorrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.members()Returns the value of themembersrecord component.nodeId()Returns the value of thenodeIdrecord component.static ClusterInfosingleNode(String nodeId) Builds the degenerate single-node snapshot used by all non-clustered backends: one local member that is also the coordinator.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ClusterInfo
public ClusterInfo(boolean clustered, String nodeId, String coordinator, String clusterName, List<ClusterInfo.Member> members) Creates an instance of aClusterInforecord class.- Parameters:
clustered- the value for theclusteredrecord componentnodeId- the value for thenodeIdrecord componentcoordinator- the value for thecoordinatorrecord componentclusterName- the value for theclusterNamerecord componentmembers- the value for themembersrecord component
-
-
Method Details
-
singleNode
Builds the degenerate single-node snapshot used by all non-clustered backends: one local member that is also the coordinator.- Parameters:
nodeId- this node's id- Returns:
- a single-node, non-clustered
ClusterInfo
-
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. -
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. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
clustered
public boolean clustered()Returns the value of theclusteredrecord component.- Returns:
- the value of the
clusteredrecord component
-
nodeId
Returns the value of thenodeIdrecord component.- Returns:
- the value of the
nodeIdrecord component
-
coordinator
Returns the value of thecoordinatorrecord component.- Returns:
- the value of the
coordinatorrecord component
-
clusterName
Returns the value of theclusterNamerecord component.- Returns:
- the value of the
clusterNamerecord component
-
members
Returns the value of themembersrecord component.- Returns:
- the value of the
membersrecord component
-