Record Class ProxyInfo
java.lang.Object
java.lang.Record
me.internalizable.numdrassl.api.cluster.ProxyInfo
- Record Components:
proxyId- unique identifier for this proxy instanceregion- the geographic region (e.g., "eu-west", "us-east")address- the public address players connect toplayerCount- current number of connected playersmaxPlayers- maximum player capacityuptimeMillis- how long the proxy has been runninglastHeartbeat- when the last heartbeat was receivedversion- the proxy version string
public record ProxyInfo(@Nonnull String proxyId, @Nonnull String region, @Nonnull InetSocketAddress address, int playerCount, int maxPlayers, long uptimeMillis, @Nonnull Instant lastHeartbeat, @Nonnull String version)
extends Record
Information about a proxy instance in the cluster.
This record is immutable and represents a snapshot of a proxy's state at a specific point in time.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the value of theaddressrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanCheck if this proxy has capacity for more players.final inthashCode()Returns a hash code value for this object.booleanisStale(long timeoutMillis) Check if this proxy's heartbeat is stale.Returns the value of thelastHeartbeatrecord component.doubleGet the load factor (0.0 to 1.0) of this proxy.intReturns the value of themaxPlayersrecord component.intReturns the value of theplayerCountrecord component.proxyId()Returns the value of theproxyIdrecord component.region()Returns the value of theregionrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of theuptimeMillisrecord component.version()Returns the value of theversionrecord component.
-
Constructor Details
-
ProxyInfo
public ProxyInfo(@Nonnull String proxyId, @Nonnull String region, @Nonnull InetSocketAddress address, int playerCount, int maxPlayers, long uptimeMillis, @Nonnull Instant lastHeartbeat, @Nonnull String version) Creates an instance of aProxyInforecord class.- Parameters:
proxyId- the value for theproxyIdrecord componentregion- the value for theregionrecord componentaddress- the value for theaddressrecord componentplayerCount- the value for theplayerCountrecord componentmaxPlayers- the value for themaxPlayersrecord componentuptimeMillis- the value for theuptimeMillisrecord componentlastHeartbeat- the value for thelastHeartbeatrecord componentversion- the value for theversionrecord component
-
-
Method Details
-
hasCapacity
public boolean hasCapacity()Check if this proxy has capacity for more players.- Returns:
- true if playerCount is less than maxPlayers
-
loadFactor
public double loadFactor()Get the load factor (0.0 to 1.0) of this proxy.- Returns:
- the ratio of current players to max capacity
-
isStale
public boolean isStale(long timeoutMillis) Check if this proxy's heartbeat is stale.- Parameters:
timeoutMillis- the timeout threshold in milliseconds- Returns:
- true if the last heartbeat is older than the timeout
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
proxyId
-
region
-
address
-
playerCount
public int playerCount()Returns the value of theplayerCountrecord component.- Returns:
- the value of the
playerCountrecord component
-
maxPlayers
public int maxPlayers()Returns the value of themaxPlayersrecord component.- Returns:
- the value of the
maxPlayersrecord component
-
uptimeMillis
public long uptimeMillis()Returns the value of theuptimeMillisrecord component.- Returns:
- the value of the
uptimeMillisrecord component
-
lastHeartbeat
Returns the value of thelastHeartbeatrecord component.- Returns:
- the value of the
lastHeartbeatrecord component
-
version
-