Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2007-2014 Sonatype, Inc. All rights reserved.
  * This program is licensed to you under the Apache License Version 2.0,
  * and you may not use this file except in compliance with the Apache License Version 2.0.
  * You may obtain a copy of the Apache License Version 2.0 at
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the Apache License Version 2.0 is distributed on an
 * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
A Guava that differs from default one by dispatching events as they appear (is re-entrant). Guava will queue up all event and dispatch them in the order they were posted, without re-entrance.

    extends DefaultGuavaEventBus

Queues of events for the current thread to dispatch.
        protected Queue<EventWithSubscriberinitialValue() {
          return new LinkedList<EventWithSubscriber>();
  void enqueueEvent(Object eventEventSubscriber subscriber) {
    .get().offer(new EventWithSubscriber(eventsubscriber));
  void dispatchQueuedEvents() {
    EventWithSubscriber eventWithSubscriber;
    while ((eventWithSubscriber = events.poll()) != null) {
  public String toString() {
    return "Reentrant Guava EventBus";
New to GrepCode? Check out our FAQ X