public class EventBusSynchronizer extends Object
EventBusSynchronizer
is used to replace the AsyncEventBus
used by Guava with a synchronous, serial EventBus
instance. This
enables testing that relies on testing the outcome of asynchronous events by
executing the events on the current thread serially.Constructor and Description |
---|
EventBusSynchronizer() |
Modifier and Type | Method and Description |
---|---|
static com.google.common.eventbus.EventBus |
synchronizeAlertEventPublisher(com.google.inject.Injector injector)
Force the
EventBus from AlertEventPublisher to be serial
and synchronous. |
static void |
synchronizeAmbariEventPublisher(com.google.inject.Binder binder)
Force the
EventBus from AmbariEventPublisher to be serial
and synchronous. |
static com.google.common.eventbus.EventBus |
synchronizeAmbariEventPublisher(com.google.inject.Injector injector)
Force the
EventBus from AlertEventPublisher to be serial
and synchronous. |
public static void synchronizeAmbariEventPublisher(com.google.inject.Binder binder)
EventBus
from AmbariEventPublisher
to be serial
and synchronous.binder
- public static com.google.common.eventbus.EventBus synchronizeAmbariEventPublisher(com.google.inject.Injector injector)
EventBus
from AlertEventPublisher
to be serial
and synchronous. Also register the known listeners. Registering known
listeners is necessary since the event bus was replaced.injector
- public static com.google.common.eventbus.EventBus synchronizeAlertEventPublisher(com.google.inject.Injector injector)
EventBus
from AlertEventPublisher
to be serial
and synchronous. Also register the known listeners. Registering known
listeners is necessary since the event bus was replaced.injector
- Copyright © 2022 Apache Software Foundation. All rights reserved.