diff options
Diffstat (limited to 'guava/src/com/google/common/eventbus/AsyncEventBus.java')
-rw-r--r-- | guava/src/com/google/common/eventbus/AsyncEventBus.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/guava/src/com/google/common/eventbus/AsyncEventBus.java b/guava/src/com/google/common/eventbus/AsyncEventBus.java index eb57aba..8018cee 100644 --- a/guava/src/com/google/common/eventbus/AsyncEventBus.java +++ b/guava/src/com/google/common/eventbus/AsyncEventBus.java @@ -16,10 +16,7 @@ package com.google.common.eventbus; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.annotations.Beta; - import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; @@ -49,7 +46,7 @@ public class AsyncEventBus extends EventBus { */ public AsyncEventBus(String identifier, Executor executor) { super(identifier); - this.executor = checkNotNull(executor); + this.executor = executor; } /** @@ -61,11 +58,11 @@ public class AsyncEventBus extends EventBus { * been posted to this event bus. */ public AsyncEventBus(Executor executor) { - this.executor = checkNotNull(executor); + this.executor = executor; } @Override - void enqueueEvent(Object event, EventHandler handler) { + protected void enqueueEvent(Object event, EventHandler handler) { eventsToDispatch.offer(new EventWithHandler(event, handler)); } @@ -73,7 +70,6 @@ public class AsyncEventBus extends EventBus { * Dispatch {@code events} in the order they were posted, regardless of * the posting thread. */ - @SuppressWarnings("deprecation") // only deprecated for external subclasses @Override protected void dispatchQueuedEvents() { while (true) { @@ -90,15 +86,14 @@ public class AsyncEventBus extends EventBus { * Calls the {@link #executor} to dispatch {@code event} to {@code handler}. */ @Override - void dispatch(final Object event, final EventHandler handler) { - checkNotNull(event); - checkNotNull(handler); - executor.execute( - new Runnable() { + protected void dispatch(final Object event, final EventHandler handler) { + executor.execute(new Runnable() { @Override + @SuppressWarnings("synthetic-access") public void run() { AsyncEventBus.super.dispatch(event, handler); } }); } + } |