Package org.openspaces.admin.machine
Interface Machines
- All Superinterfaces:
AdminAware,Iterable<Machine>
- All Known Subinterfaces:
InternalMachines
- All Known Implementing Classes:
DefaultMachines
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
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(MachineLifecycleEventListener eventListener) Allows to add aMachineLifecycleEventListener.Returns a map of machines by host address.Returns a map of machines by host names.Returns the machines added event manager allowing to add and removeMachineAddedEventListeners.getMachineByHostAddress(String hostAddress) Returns the machine by the host address.getMachineByHostName(String hostName) Returns the machine by the host name.Returns the grid service container added event manager allowing to add and removeMachineRemovedEventListeners.Machine[]Returns all currently discovered machines.intgetSize()Returns the number of machines current discovered.getUids()Returns a map of machines with the key as the uid.booleanisEmpty()Returnstrueif there are no machines,falseotherwise.voidremoveLifeycleListener(MachineLifecycleEventListener eventListener) Allows to remove aMachineLifecycleEventListener.booleanwaitFor(int numberOfMachines) Waits indefinitely till the provided number of machines are up.booleanWaits for the given timeout (in time unit) till the provided number of machines are up.Waits indefinitely till the machine with the given host (name/address) is discovered.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
getAdminMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getMachines
Machine[] getMachines()Returns all currently discovered machines. -
getMachineByHostAddress
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,
nullif there is no one
-
getMachineByHostName
Returns the machine by the host name. -
getUids
Returns a map of machines with the key as the uid. -
getHostsByAddress
Returns a map of machines by host address. -
getHostsByName
Returns a map of machines by host names. -
getSize
int getSize()Returns the number of machines current discovered. -
isEmpty
boolean isEmpty()Returnstrueif there are no machines,falseotherwise. -
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
Waits for the given timeout (in time unit) till the provided number of machines are up. Returnstrueif the required number of machines were discovered,falseif the timeout expired.- Parameters:
numberOfMachines- The number of containers to wait for
-
waitFor
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
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, ornullif the machine was not discovered.- Parameters:
host- The machine host name or addresstimeout- The timeout value to waittimeUnit- The time unit of the timeout value- Returns:
- The machien discovered, or
nullif it was not discovered within the provided timeout
-
getMachineAdded
MachineAddedEventManager getMachineAdded()Returns the machines added event manager allowing to add and removeMachineAddedEventListeners. -
getMachineRemoved
MachineRemovedEventManager getMachineRemoved()Returns the grid service container added event manager allowing to add and removeMachineRemovedEventListeners. -
addLifecycleListener
Allows to add aMachineLifecycleEventListener. -
removeLifeycleListener
Allows to remove aMachineLifecycleEventListener.
-