Class MachinePool


  • public class MachinePool
    extends java.lang.Object
    Represents a snapshot of the machine pool managed by a CloudPool.
    See Also:
    CloudPool
    • Constructor Detail

      • MachinePool

        public MachinePool​(java.util.List<? extends Machine> machines,
                           org.joda.time.DateTime timestamp)
        Constructs a new MachinePool snapshot.
        Parameters:
        machines - The machine instances that were part of the machine pool at the time of the snapshot.
        timestamp - The time when this snapshot of the resource pool was taken.
    • Method Detail

      • getTimestamp

        public org.joda.time.DateTime getTimestamp()
        Returns the time at which the pool observation was made. Note that in case the cloud pool serves locally cached data, this field may be used by the client to determine if the data is fresh enough to be acted upon.
        Returns:
      • emptyPool

        public static MachinePool emptyPool​(org.joda.time.DateTime timestamp)
        Factory method for creating an empty machine pool.
        Parameters:
        timestamp - The timestamp of the machine pool.
        Returns:
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromJson

        public static MachinePool fromJson​(java.lang.String machinePoolAsJson)
                                    throws java.io.IOException
        Parses a JSON representation of a MachinePool to its Java counterpart. Any failure to parse the JSON representation into a valid MachinePool instance results in an exception being thrown.
        Parameters:
        machinePoolAsJson -
        Returns:
        Throws:
        java.io.IOException
      • toJson

        public com.google.gson.JsonObject toJson()
        Returns the JSON representation for this MachinePool.
        Returns:
        A JsonObject representation of this MachinePool.