Record Class ClusterInfo

java.lang.Object
java.lang.Record
org.mockserver.state.ClusterInfo
Record Components:
clustered - whether this node participates in a multi-node cluster
nodeId - this node's unique id
coordinator - the id/address of the cluster coordinator, or this node's id when not clustered
clusterName - the configured cluster name, or null/empty when not clustered
members - 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.

  • Constructor Details

    • ClusterInfo

      public ClusterInfo(boolean clustered, String nodeId, String coordinator, String clusterName, List<ClusterInfo.Member> members)
      Creates an instance of a ClusterInfo record class.
      Parameters:
      clustered - the value for the clustered record component
      nodeId - the value for the nodeId record component
      coordinator - the value for the coordinator record component
      clusterName - the value for the clusterName record component
      members - the value for the members record component
  • Method Details

    • singleNode

      public static ClusterInfo singleNode(String nodeId)
      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

      public final 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 '=='.
      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.
    • clustered

      public boolean clustered()
      Returns the value of the clustered record component.
      Returns:
      the value of the clustered record component
    • nodeId

      public String nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component
    • coordinator

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

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

      public List<ClusterInfo.Member> members()
      Returns the value of the members record component.
      Returns:
      the value of the members record component