|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.events.impl.DefaultHub
public class DefaultHub
Default Hub implementation.
| Constructor Summary | |
|---|---|
DefaultHub()
|
|
DefaultHub(ExecutorService service)
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultHub()
public DefaultHub(ExecutorService service)
| Method Detail |
|---|
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.
subscribe in interface Hubobject - the observerObservespublic boolean unsubscribe(Object observer)
Hub
unsubscribe in interface Hubobserver - the observer
true if the observer is found and unsubscribed.
public void fire(Object event,
String... qualifiers)
Hub
fire in interface Hubevent - the eventqualifiers - optional event qualifierspublic void waitFor(Class<?> eventType)
Hub
waitFor in interface HubeventType - the event type
public void waitFor(Class<?> eventType,
long duration,
TimeUnit unit)
Hub
waitFor in interface HubeventType - the event typeduration - the length of time to wait forunit - the time unit of the durationpublic void stop()
Hub
stop in interface Hub
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||