| Constructor and Description |
|---|
DefaultHub() |
DefaultHub(ExecutorService service) |
| Modifier and Type | Method and Description |
|---|---|
void |
fire(Object event,
String... qualifiers)
Fires an event to all observers which have subscribed for them, blocking the client until all the critical
observers have executed.
|
void |
stop()
Signals that this hub is no longer needed and can release its resources.
|
void |
subscribe(Object object)
Subscribes an observer for notification of events of a given type.
|
boolean |
unsubscribe(Object observer)
Unsubscribes an observer.
|
void |
waitFor(Class<?> eventType)
Blocks the caller until an event of a given type occurs.
|
void |
waitFor(Class<?> eventType,
long duration,
TimeUnit unit)
Blocks the caller until an event of a given type occurs or a given length of time elapses.
|
public DefaultHub()
public DefaultHub(ExecutorService service)
public void subscribe(Object object)
Hub
The single parameter of any method of the observer annotated with Observes identifies the type of the
events observed by the observer.
public boolean unsubscribe(Object observer)
Hubunsubscribe in interface Hubobserver - the observertrue if the observer is found and unsubscribed.public void fire(Object event, String... qualifiers)
Hubpublic void waitFor(Class<?> eventType)
Hubpublic void waitFor(Class<?> eventType, long duration, TimeUnit unit)
HubCopyright © 2017. All Rights Reserved.