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.
package org.sonatype.sisu.goodies.eventbus.internal;
import static;

org.sonatype.sisu.goodies.eventbus.EventBus implementation using guava event bus.

It differs from guava event bus 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.

public class DefaultEventBus
    implements EventBus
  public static final Logger LOG = LoggerFactory.getLogger(DefaultEventBus.class);
  private static final Marker REGISTRATION = MarkerFactory.getMarker("registration");
  public static final Marker DISPATCHING = MarkerFactory.getMarker("dispatching");
  public DefaultEventBus(final @Named("${guava.eventBus:-reentrant}" eventBus) {
    this. = checkNotNull(eventBus);
    .info("Using {}"eventBus);
  public EventBus register(final Object handler) {
    .debug("Registered handler '{}'"handler);
    return this;
  public EventBus unregister(final Object handler) {
    .debug("Unregistered handler '{}'"handler);
    return this;
  public EventBus post(final Object event) {
    .debug("Event '{}' fired"event);
    return this;
New to GrepCode? Check out our FAQ X