public class DefaultBuckEventBus extends Object implements BuckEventBus
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SHUTDOWN_TIMEOUT_MS |
| Constructor and Description |
|---|
DefaultBuckEventBus(Clock clock,
boolean async,
BuildId buildId,
int shutdownTimeoutMillis) |
DefaultBuckEventBus(Clock clock,
BuildId buildId) |
DefaultBuckEventBus(Clock clock,
BuildId buildId,
int shutdownTimeoutMillis,
ExecutorService executorService) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit) is called to wait
for events which have been posted, but which have been queued by the EventBus, to be
delivered. |
BuildId |
getBuildId()
An id that every event posted to this event bus will share.
|
void |
post(BuckEvent event) |
void |
post(BuckEvent event,
BuckEvent atTime)
Post event to the EventBus using the timestamp given by atTime.
|
void |
postWithoutConfiguring(BuckEvent event) |
void |
register(Object object)
Register a listener to process events
|
void |
timestamp(BuckEvent event)
Timestamp event.
|
void |
unregister(Object object)
Remove a listener previously specified with
register() |
boolean |
waitEvents(long timeout)
Wait for all currently running events to dispatch and finish executing
|
public static final int DEFAULT_SHUTDOWN_TIMEOUT_MS
public DefaultBuckEventBus(Clock clock, boolean async, BuildId buildId, int shutdownTimeoutMillis)
public DefaultBuckEventBus(Clock clock, BuildId buildId, int shutdownTimeoutMillis, ExecutorService executorService)
public void post(BuckEvent event)
post in interface EventDispatcherpublic void post(BuckEvent event, BuckEvent atTime)
post in interface EventDispatcherpublic void register(Object object)
BuckEventBusregister in interface BuckEventBuspublic void unregister(Object object)
BuckEventBusregister()unregister in interface BuckEventBuspublic void postWithoutConfiguring(BuckEvent event)
postWithoutConfiguring in interface EventDispatcherpublic BuildId getBuildId()
In practice, this should be a short string, because it may be sent over the wire frequently.
getBuildId in interface BuckEventBuspublic void close()
ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit) is called to wait
for events which have been posted, but which have been queued by the EventBus, to be
delivered. This allows listeners to record or report as much information as possible. This aids
debugging when close is called during exception processing.close in interface Closeableclose in interface AutoCloseablepublic boolean waitEvents(long timeout)
BuckEventBuswaitEvents in interface BuckEventBustimeout - Time in milliseconds to wait for completion, if timeout is not greater than 0
then it will wait indefinitelypublic void timestamp(BuckEvent event)
timestamp in interface EventDispatcher