Package 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
AnEventBus
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
Constructors Constructor Description AsyncEventBus(String identifier, Executor executor)
Creates a new AsyncEventBus that will useexecutor
to dispatch events.AsyncEventBus(Executor executor)
Creates a new AsyncEventBus that will useexecutor
to dispatch events.AsyncEventBus(Executor executor, SubscriberExceptionHandler subscriberExceptionHandler)
Creates a new AsyncEventBus that will useexecutor
to dispatch events.
-
-
-
Constructor Detail
-
AsyncEventBus
public AsyncEventBus(String identifier, Executor executor)
Creates a new AsyncEventBus that will useexecutor
to dispatch events. Assignsidentifier
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, SubscriberExceptionHandler subscriberExceptionHandler)
Creates a new AsyncEventBus that will useexecutor
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.subscriberExceptionHandler
- Handler used to handle exceptions thrown from subscribers. SeeSubscriberExceptionHandler
for more information.- Since:
- 16.0
-
AsyncEventBus
public AsyncEventBus(Executor executor)
Creates a new AsyncEventBus that will useexecutor
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.
-
-