|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.eventbus.EventBus com.google.common.eventbus.AsyncEventBus
@Beta public class AsyncEventBus
An EventBus
that takes the Executor of your choice and uses it to
dispatch events, allowing dispatch to occur asynchronously.
Constructor Summary | |
---|---|
AsyncEventBus(Executor executor)
Creates a new AsyncEventBus that will use executor to dispatch
events. |
|
AsyncEventBus(String identifier,
Executor executor)
Creates a new AsyncEventBus that will use executor to dispatch
events. |
Method Summary | |
---|---|
protected void |
dispatch(Object event,
com.google.common.eventbus.EventHandler handler)
Calls the executor to dispatch event to handler . |
protected void |
dispatchQueuedEvents()
Dispatch events in the order they were posted, regardless of
the posting thread. |
protected void |
enqueueEvent(Object event,
com.google.common.eventbus.EventHandler handler)
Queue the event for dispatch during
EventBus.dispatchQueuedEvents() . |
Methods inherited from class com.google.common.eventbus.EventBus |
---|
newHandlerSet, post, register, unregister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncEventBus(String identifier, Executor executor)
executor
to dispatch
events. Assigns identifier
as the bus's name for logging purposes.
identifier
- short name for the bus, for logging purposes.executor
- Executor to use to dispatch events. It is the caller's
responsibility to shut down the executor after the last event has
been posted to this event bus.public AsyncEventBus(Executor executor)
executor
to dispatch
events.
executor
- Executor to use to dispatch events. It is the caller's
responsibility to shut down the executor after the last event has
been posted to this event bus.Method Detail |
---|
protected void enqueueEvent(Object event, com.google.common.eventbus.EventHandler handler)
EventBus
event
for dispatch during
EventBus.dispatchQueuedEvents()
. Events are queued in-order of occurrence
so they can be dispatched in the same order.
enqueueEvent
in class EventBus
protected void dispatchQueuedEvents()
events
in the order they were posted, regardless of
the posting thread.
dispatchQueuedEvents
in class EventBus
protected void dispatch(Object event, com.google.common.eventbus.EventHandler handler)
executor
to dispatch event
to handler
.
dispatch
in class EventBus
event
- event to dispatch.handler
- wrapper that will call the handler.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |