Class Wrapper

java.lang.Object
de.rexlcloud.core.api.Wrapper
All Implemented Interfaces:
Serializable

public class Wrapper extends Object implements Serializable
A wrapper (a machine that runs servers) as the API sees it, with the resource usage it last reported.
See Also:
  • Constructor Details

    • Wrapper

      public Wrapper(@NonNull @NonNull String name, boolean online, double cpuUsage, long usedMemory, long freeMemory, long totalMemory)
      Creates a new Wrapper instance.
      Parameters:
      name - Name of the wrapper, e.g. Wrapper-1.
      online - Whether the wrapper is connected to the master.
      cpuUsage - CPU load of the wrapper's machine from 0 to 1; negative if unknown.
      usedMemory - Memory of the machine in bytes: in use, available to new servers (including the page cache the system gives back) and in total.
      freeMemory -
      totalMemory -
  • Method Details

    • update

      protected void update(Wrapper wrapper)
      Internal: applies a newer state of the wrapper.
    • getCpuUsagePercent

      public String getCpuUsagePercent()
      Returns:
      the CPU load as text, e.g. 12.50%
    • getTotalMemoryString

      public String getTotalMemoryString()
      Returns:
      the total memory in GB as text, e.g. 15.62
    • getUsedMemoryString

      public String getUsedMemoryString()
      Returns:
      the memory in use in GB as text
    • getFreeMemoryString

      public String getFreeMemoryString()
      Returns:
      the available memory in GB as text
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getName

      @NonNull public @NonNull String getName()
      Name of the wrapper, e.g. Wrapper-1.
    • isOnline

      public boolean isOnline()
      Whether the wrapper is connected to the master.
    • getCpuUsage

      public double getCpuUsage()
      CPU load of the wrapper's machine from 0 to 1; negative if unknown.
    • getUsedMemory

      public long getUsedMemory()
      Memory of the machine in bytes: in use, available to new servers (including the page cache the system gives back) and in total.
    • getFreeMemory

      public long getFreeMemory()
    • getTotalMemory

      public long getTotalMemory()