public class EmbeddedDaemonRegistry extends Object implements DaemonRegistry, Stoppable
This implementation is thread safe in that its getAll(), getIdle() and getBusy() methods are expected to be called from ?consumer? threads, while the newEntry() method is expected to be called by ?producer? threads.
The collections returned by the consumer methods do not return live collections so may not reflect the precise state of the registry by the time they are returned to the caller. Clients must therefore be prepared for this and expect connection failures, either through the endpoint disappearing or becoming busy between asking for idle daemons and trying to connect.
DaemonRegistry.EmptyRegistryException| Constructor and Description |
|---|
EmbeddedDaemonRegistry() |
| Modifier and Type | Method and Description |
|---|---|
List<DaemonInfo> |
getAll() |
List<DaemonInfo> |
getBusy() |
List<Daemon> |
getDaemons()
Returns all daemons started in this registry since construction or most recent stopDaemons().
|
List<DaemonInfo> |
getIdle() |
void |
markBusy(Address address) |
void |
markIdle(Address address) |
void |
remove(Address address) |
void |
startDaemon(Daemon daemon) |
void |
stop()
Requests a graceful stop of this object.
|
void |
store(Address address,
DaemonContext daemonContext,
String password) |
public List<DaemonInfo> getAll()
getAll in interface DaemonRegistrypublic List<DaemonInfo> getIdle()
getIdle in interface DaemonRegistrypublic List<DaemonInfo> getBusy()
getBusy in interface DaemonRegistrypublic void store(Address address, DaemonContext daemonContext, String password)
store in interface DaemonRegistrypublic void remove(Address address)
remove in interface DaemonRegistrypublic void markBusy(Address address)
markBusy in interface DaemonRegistrypublic void markIdle(Address address)
markIdle in interface DaemonRegistrypublic List<Daemon> getDaemons()
The returned daemons are not guaranteed to be running as they may have been stopped individually.
public void startDaemon(Daemon daemon)
Copyright © 2013. All rights reserved