Record Class ProxyInfo

java.lang.Object
java.lang.Record
me.internalizable.numdrassl.api.cluster.ProxyInfo
Record Components:
proxyId - unique identifier for this proxy instance
region - the geographic region (e.g., "eu-west", "us-east")
address - the public address players connect to
playerCount - current number of connected players
maxPlayers - maximum player capacity
uptimeMillis - how long the proxy has been running
lastHeartbeat - when the last heartbeat was received
version - 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 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 a ProxyInfo record class.
      Parameters:
      proxyId - the value for the proxyId record component
      region - the value for the region record component
      address - the value for the address record component
      playerCount - the value for the playerCount record component
      maxPlayers - the value for the maxPlayers record component
      uptimeMillis - the value for the uptimeMillis record component
      lastHeartbeat - the value for the lastHeartbeat record component
      version - the value for the version record 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

      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 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.
    • proxyId

      @Nonnull public String proxyId()
      Returns the value of the proxyId record component.
      Returns:
      the value of the proxyId record component
    • region

      @Nonnull public String region()
      Returns the value of the region record component.
      Returns:
      the value of the region record component
    • address

      @Nonnull public InetSocketAddress address()
      Returns the value of the address record component.
      Returns:
      the value of the address record component
    • playerCount

      public int playerCount()
      Returns the value of the playerCount record component.
      Returns:
      the value of the playerCount record component
    • maxPlayers

      public int maxPlayers()
      Returns the value of the maxPlayers record component.
      Returns:
      the value of the maxPlayers record component
    • uptimeMillis

      public long uptimeMillis()
      Returns the value of the uptimeMillis record component.
      Returns:
      the value of the uptimeMillis record component
    • lastHeartbeat

      @Nonnull public Instant lastHeartbeat()
      Returns the value of the lastHeartbeat record component.
      Returns:
      the value of the lastHeartbeat record component
    • version

      @Nonnull public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component