AsyncEventBus.java 1.73 KB
package com.google.common.eventbus;

import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import qn;

@Beta
public class AsyncEventBus
  extends EventBus
{
  private final Executor a;
  private final ConcurrentLinkedQueue<EventBus.a> b = new ConcurrentLinkedQueue();
  
  public AsyncEventBus(String paramString, Executor paramExecutor)
  {
    super(paramString);
    this.a = ((Executor)Preconditions.checkNotNull(paramExecutor));
  }
  
  public AsyncEventBus(Executor paramExecutor)
  {
    super("default");
    this.a = ((Executor)Preconditions.checkNotNull(paramExecutor));
  }
  
  public AsyncEventBus(Executor paramExecutor, SubscriberExceptionHandler paramSubscriberExceptionHandler)
  {
    super(paramSubscriberExceptionHandler);
    this.a = ((Executor)Preconditions.checkNotNull(paramExecutor));
  }
  
  final void a(Object paramObject, qn paramqn)
  {
    this.b.offer(new EventBus.a(paramObject, paramqn));
  }
  
  final void b(final Object paramObject, final qn paramqn)
  {
    Preconditions.checkNotNull(paramObject);
    Preconditions.checkNotNull(paramqn);
    this.a.execute(new Runnable()
    {
      public final void run()
      {
        AsyncEventBus.a(AsyncEventBus.this, paramObject, paramqn);
      }
    });
  }
  
  protected void dispatchQueuedEvents()
  {
    for (;;)
    {
      EventBus.a locala = (EventBus.a)this.b.poll();
      if (locala == null) {
        break;
      }
      b(locala.a, locala.b);
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/eventbus/AsyncEventBus.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */