public interface Machines extends AdminAware, Iterable<Machine>
Machine
s 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.
Modifier and Type | Method and Description |
---|---|
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
MachineAddedEventListener s. |
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
MachineRemovedEventListener s. |
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.
|
getAdmin
forEach, iterator, spliterator
Machine[] getMachines()
Machine getMachineByHostAddress(String hostAddress)
hostAddress
- The host address to lookup the machine bynull
if there is
no oneMachine getMachineByHostName(String hostName)
Map<String,Machine> getHostsByAddress()
int getSize()
boolean isEmpty()
true
if there are no machines, false
otherwise.boolean waitFor(int numberOfMachines)
numberOfMachines
- The number of containers to wait forboolean waitFor(int numberOfMachines, long timeout, TimeUnit timeUnit)
true
if the required number of machines were discovered,
false
if the timeout expired.numberOfMachines
- The number of containers to wait forMachine waitFor(String host)
host
- The machine host name or addressMachine waitFor(String host, long timeout, TimeUnit timeUnit)
null
if the machine was not discovered.host
- The machine host name or addresstimeout
- The timeout value to waittimeUnit
- The time unit of the timeout valuenull
if it was not discovered within the
provided timeoutMachineAddedEventManager getMachineAdded()
MachineAddedEventListener
s.MachineRemovedEventManager getMachineRemoved()
MachineRemovedEventListener
s.void addLifecycleListener(MachineLifecycleEventListener eventListener)
MachineLifecycleEventListener
.void removeLifeycleListener(MachineLifecycleEventListener eventListener)
MachineLifecycleEventListener
.Copyright © GigaSpaces.