ExecutionList.java 2.73 KB
package com.google.common.util.concurrent;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;

public final class ExecutionList
{
  @VisibleForTesting
  static final Logger a = Logger.getLogger(ExecutionList.class.getName());
  @GuardedBy("this")
  private a b;
  @GuardedBy("this")
  private boolean c;
  
  private static void a(Runnable paramRunnable, Executor paramExecutor)
  {
    try
    {
      paramExecutor.execute(paramRunnable);
      return;
    }
    catch (RuntimeException localRuntimeException)
    {
      Logger localLogger = a;
      Level localLevel = Level.SEVERE;
      paramRunnable = String.valueOf(String.valueOf(paramRunnable));
      paramExecutor = String.valueOf(String.valueOf(paramExecutor));
      localLogger.log(localLevel, paramRunnable.length() + 57 + paramExecutor.length() + "RuntimeException while executing runnable " + paramRunnable + " with executor " + paramExecutor, localRuntimeException);
    }
  }
  
  public final void add(Runnable paramRunnable, Executor paramExecutor)
  {
    Preconditions.checkNotNull(paramRunnable, "Runnable was null.");
    Preconditions.checkNotNull(paramExecutor, "Executor was null.");
    try
    {
      if (!this.c)
      {
        this.b = new a(paramRunnable, paramExecutor, this.b);
        return;
      }
      a(paramRunnable, paramExecutor);
      return;
    }
    finally {}
  }
  
  public final void execute()
  {
    Object localObject1 = null;
    Object localObject4;
    try
    {
      if (this.c) {
        return;
      }
      this.c = true;
      Object localObject3 = this.b;
      this.b = null;
      for (;;)
      {
        localObject4 = localObject1;
        if (localObject3 == null) {
          break;
        }
        localObject4 = ((a)localObject3).c;
        ((a)localObject3).c = ((a)localObject1);
        localObject1 = localObject3;
        localObject3 = localObject4;
      }
      if (localObject4 == null) {
        return;
      }
    }
    finally {}
    for (;;)
    {
      a(((a)localObject4).a, ((a)localObject4).b);
      localObject4 = ((a)localObject4).c;
    }
  }
  
  static final class a
  {
    final Runnable a;
    final Executor b;
    @Nullable
    a c;
    
    a(Runnable paramRunnable, Executor paramExecutor, a parama)
    {
      this.a = paramRunnable;
      this.b = paramExecutor;
      this.c = parama;
    }
  }
}


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