Class DefaultMachines

java.lang.Object
org.openspaces.admin.internal.machine.DefaultMachines
All Implemented Interfaces:
Iterable<Machine>, AdminAware, InternalMachines, Machines

public class DefaultMachines extends Object implements InternalMachines
Author:
kimchy
  • Constructor Details

  • Method Details

    • getAdmin

      public Admin getAdmin()
      Description copied from interface: AdminAware
      Returns the Admin associated with this element.
      Specified by:
      getAdmin in interface AdminAware
    • getMachines

      public Machine[] getMachines()
      Description copied from interface: Machines
      Returns all currently discovered machines.
      Specified by:
      getMachines in interface Machines
    • getMachineAdded

      public MachineAddedEventManager getMachineAdded()
      Description copied from interface: Machines
      Returns the machines added event manager allowing to add and remove MachineAddedEventListeners.
      Specified by:
      getMachineAdded in interface Machines
    • getMachineRemoved

      public MachineRemovedEventManager getMachineRemoved()
      Description copied from interface: Machines
      Returns the grid service container added event manager allowing to add and remove MachineRemovedEventListeners.
      Specified by:
      getMachineRemoved in interface Machines
    • getSize

      public int getSize()
      Description copied from interface: Machines
      Returns the number of machines current discovered.
      Specified by:
      getSize in interface Machines
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Machines
      Returns true if there are no machines, false otherwise.
      Specified by:
      isEmpty in interface Machines
    • waitFor

      public boolean waitFor(int numberOfMachines)
      Description copied from interface: Machines
      Waits indefinitely till the provided number of machines are up.
      Specified by:
      waitFor in interface Machines
      Parameters:
      numberOfMachines - The number of containers to wait for
    • waitFor

      public boolean waitFor(int numberOfMachines, long timeout, TimeUnit timeUnit)
      Description copied from interface: Machines
      Waits for the given timeout (in time unit) till the provided number of machines are up. Returns true if the required number of machines were discovered, false if the timeout expired.
      Specified by:
      waitFor in interface Machines
      Parameters:
      numberOfMachines - The number of containers to wait for
    • waitFor

      public Machine waitFor(String hostAddress)
      Description copied from interface: Machines
      Waits indefinitely till the machine with the given host (name/address) is discovered.
      Specified by:
      waitFor in interface Machines
      Parameters:
      hostAddress - The machine host name or address
      Returns:
      The machine discovered
    • waitFor

      public Machine waitFor(String hostAddress, long timeout, TimeUnit timeUnit)
      Description copied from interface: Machines
      Waits for the given timeout (in time unit) till the machien with the given host (name/address) is discovered. Returns the machine if it was discovered within the provided timeout, or null if the machine was not discovered.
      Specified by:
      waitFor in interface Machines
      Parameters:
      hostAddress - The machine host name or address
      timeout - The timeout value to wait
      timeUnit - The time unit of the timeout value
      Returns:
      The machien discovered, or null if it was not discovered within the provided timeout
    • iterator

      public Iterator<Machine> iterator()
      Specified by:
      iterator in interface Iterable<Machine>
    • getMachineByUID

      public Machine getMachineByUID(String uid)
      Specified by:
      getMachineByUID in interface InternalMachines
    • getMachineByHostAddress

      public Machine getMachineByHostAddress(String ipAddress)
      Description copied from interface: Machines
      Returns the machine by the host address.
      Specified by:
      getMachineByHostAddress in interface Machines
      Parameters:
      ipAddress - The host address to lookup the machine by
      Returns:
      The machine correlated to the specified host address, null if there is no one
    • getMachineByHostName

      public Machine getMachineByHostName(String hostName)
      Description copied from interface: Machines
      Returns the machine by the host name.
      Specified by:
      getMachineByHostName in interface Machines
    • getUids

      public Map<String,Machine> getUids()
      Description copied from interface: Machines
      Returns a map of machines with the key as the uid.
      Specified by:
      getUids in interface Machines
    • getHostsByAddress

      public Map<String,Machine> getHostsByAddress()
      Description copied from interface: Machines
      Returns a map of machines by host address.
      Specified by:
      getHostsByAddress in interface Machines
    • getHostsByName

      public Map<String,Machine> getHostsByName()
      Description copied from interface: Machines
      Returns a map of machines by host names.
      Specified by:
      getHostsByName in interface Machines
    • addLifecycleListener

      public void addLifecycleListener(MachineLifecycleEventListener eventListener)
      Description copied from interface: Machines
      Specified by:
      addLifecycleListener in interface Machines
    • removeLifeycleListener

      public void removeLifeycleListener(MachineLifecycleEventListener eventListener)
      Description copied from interface: Machines
      Allows to remove a MachineLifecycleEventListener.
      Specified by:
      removeLifeycleListener in interface Machines
    • addMachine

      public void addMachine(InternalMachine machine)
      Specified by:
      addMachine in interface InternalMachines
    • removeMachine

      public void removeMachine(Machine machine)
      Specified by:
      removeMachine in interface InternalMachines