migrator / guava-libraries-2

Guava: Google Core Libraries for Java 1.6+
0 stars 0 forks source link

Allow AsyncEventBus to drain its queue #8

Open migrator opened 9 years ago

migrator commented 9 years ago

As issue #1348 is not really going anywhere right now, I am trying to shut down an AsyncEventBus instance in a controlled manner (ensure that no new events are enqueued, make sure that all events in the queue get dispatched before shut down).

Right now, this is pretty hard and requires dancing around the black box that the event bus is (https://github.com/groupon/jesos/blob/master/src/main/java/com/groupon/mesos/util/ManagedEventBus.java).

It would be great to have a defined way to "shut down" an event bus so that it no longer accepts new events and also a way to ask it whether it is "fully drained" (No events in flight).

As the current event bus code is all package private, the only way to actually implement it is to shim my code into the com.google package which seems to be weird. So consider this another vote to make EventBus and AsyncEventBus easily extendable.

relevance: 2