GigaSpaces XAP 7.0 API

org.openspaces.admin.machine
Interface Machines

All Superinterfaces:
AdminAware, Iterable<Machine>

public interface Machines
extends AdminAware, Iterable<Machine>

Machines hold all the different Machines that are currently discovered.

Provides simple means to get all the current machines, as well as as registering for machine lifecycle (added and removed) events.

Author:
kimchy

Method Summary
 void addLifecycleListener(MachineLifecycleEventListener eventListener)
          Allows to add a MachineLifecycleEventListener.
 Map<String,Machine> getHostsByAddress()
          Returns a map of machines by host address.
 Map<String,Machine> getHostsByName()
          Returns a map of machines by host names.
 MachineAddedEventManager getMachineAdded()
          Returns the machines added event manager allowing to add and remove MachineAddedEventListeners.
 Machine getMachineByHostAddress(String hostAddress)
          Returns the machine by the host address.
 Machine getMachineByHostName(String hostName)
          Returns the machine by the host name.
 MachineRemovedEventManager getMachineRemoved()
          Returns the grid service container added event manager allowing to add and remove MachineRemovedEventListeners.
 Machine[] getMachines()
          Returns all currently discovered machines.
 int getSize()
          Returns the number of machines current discovered.
 Map<String,Machine> getUids()
          Returns a map of machines with the key as the uid.
 boolean isEmpty()
          Returns true if there are no machines, false otherwise.
 void removeLifeycleListener(MachineLifecycleEventListener eventListener)
          Allows to remove a MachineLifecycleEventListener.
 boolean waitFor(int numberOfMachines)
          Waits indefinitely till the provided number of machines are up.
 boolean waitFor(int numberOfMachines, long timeout, TimeUnit timeUnit)
          Waits for the given timeout (in time unit) till the provided number of machines are up.
 Machine waitFor(String host)
          Waits indefinitely till the machine with the given host (name/address) is discovered.
 Machine waitFor(String host, long timeout, TimeUnit timeUnit)
          Waits for the given timeout (in time unit) till the machien with the given host (name/address) is discovered.
 
Methods inherited from interface org.openspaces.admin.AdminAware
getAdmin
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

getMachines

Machine[] getMachines()
Returns all currently discovered machines.


getMachineByHostAddress

Machine getMachineByHostAddress(String hostAddress)
Returns the machine by the host address.

Parameters:
hostAddress - The host address to lookup the machine by
Returns:
The machine correlated to the specified host address, null if there is no one

getMachineByHostName

Machine getMachineByHostName(String hostName)
Returns the machine by the host name.


getUids

Map<String,Machine> getUids()
Returns a map of machines with the key as the uid.


getHostsByAddress

Map<String,Machine> getHostsByAddress()
Returns a map of machines by host address.


getHostsByName

Map<String,Machine> getHostsByName()
Returns a map of machines by host names.


getSize

int getSize()
Returns the number of machines current discovered.


isEmpty

boolean isEmpty()
Returns true if there are no machines, false otherwise.


waitFor

boolean waitFor(int numberOfMachines)
Waits indefinitely till the provided number of machines are up.

Parameters:
numberOfMachines - The number of containers to wait for

waitFor

boolean waitFor(int numberOfMachines,
                long timeout,
                TimeUnit timeUnit)
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.

Parameters:
numberOfMachines - The number of containers to wait for

waitFor

Machine waitFor(String host)
Waits indefinitely till the machine with the given host (name/address) is discovered.

Parameters:
host - The machine host name or address
Returns:
The machine discovered

waitFor

Machine waitFor(String host,
                long timeout,
                TimeUnit timeUnit)
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.

Parameters:
host - 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

getMachineAdded

MachineAddedEventManager getMachineAdded()
Returns the machines added event manager allowing to add and remove MachineAddedEventListeners.


getMachineRemoved

MachineRemovedEventManager getMachineRemoved()
Returns the grid service container added event manager allowing to add and remove MachineRemovedEventListeners.


addLifecycleListener

void addLifecycleListener(MachineLifecycleEventListener eventListener)
Allows to add a MachineLifecycleEventListener.


removeLifeycleListener

void removeLifeycleListener(MachineLifecycleEventListener eventListener)
Allows to remove a MachineLifecycleEventListener.


GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.