com.google.common.eventbus
Class AsyncEventBus
java.lang.Object
com.google.common.eventbus.EventBus
com.google.common.eventbus.AsyncEventBus
@Beta
public class AsyncEventBus
- extends EventBus
An EventBus
that takes the Executor of your choice and uses it to
dispatch events, allowing dispatch to occur asynchronously.
- Since:
- 10.0
- Author:
- Cliff Biffle
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 |
dispatchQueuedEvents()
Dispatch events in the order they were posted, regardless of
the posting thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AsyncEventBus
public AsyncEventBus(String identifier,
Executor executor)
- Creates a new AsyncEventBus that will use
executor
to dispatch
events. Assigns identifier
as the bus's name for logging purposes.
- Parameters:
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.
AsyncEventBus
public AsyncEventBus(Executor executor)
- Creates a new AsyncEventBus that will use
executor
to dispatch
events.
- Parameters:
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.
dispatchQueuedEvents
protected void dispatchQueuedEvents()
- Dispatch
events
in the order they were posted, regardless of
the posting thread.
- Overrides:
dispatchQueuedEvents
in class EventBus
Copyright © 2010-2012. All Rights Reserved.