zzaud.java 17.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
package com.google.android.gms.internal;

import android.os.Looper;
import com.google.android.gms.common.internal.zzac;
import hz;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

public class zzaud
  extends hz
{
  private static final AtomicLong k = new AtomicLong(Long.MIN_VALUE);
  private ExecutorService a;
  private d b;
  private d c;
  private final PriorityBlockingQueue<FutureTask<?>> d = new PriorityBlockingQueue();
  private final BlockingQueue<FutureTask<?>> e = new LinkedBlockingQueue();
  private final Thread.UncaughtExceptionHandler f = new b("Thread death: Uncaught exception on worker thread");
  private final Thread.UncaughtExceptionHandler g = new b("Thread death: Uncaught exception on network thread");
  private final Object h = new Object();
  private final Semaphore i = new Semaphore(2);
  private volatile boolean j;
  
  zzaud(zzaue paramzzaue)
  {
    super(paramzzaue);
  }
  
  private void a(c<?> paramc)
  {
    synchronized (this.h)
    {
      this.d.add(paramc);
      if (this.b == null)
      {
        this.b = new d("Measurement Worker", this.d);
        this.b.setUncaughtExceptionHandler(this.f);
        this.b.start();
        return;
      }
      this.b.a();
    }
  }
  
  final ExecutorService a()
  {
    synchronized (this.h)
    {
      if (this.a == null) {
        this.a = new ThreadPoolExecutor(0, 1, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue(100));
      }
      ExecutorService localExecutorService = this.a;
      return localExecutorService;
    }
  }
  
  public void zzJX()
  {
    if (Thread.currentThread() != this.c) {
      throw new IllegalStateException("Call expected from network thread");
    }
  }
  
  public boolean zzMq()
  {
    return Thread.currentThread() == this.b;
  }
  
  public boolean zzbc()
  {
    return Looper.myLooper() == Looper.getMainLooper();
  }
  
  public <V> Future<V> zzd(Callable<V> paramCallable)
    throws IllegalStateException
  {
    zzob();
    zzac.zzw(paramCallable);
    paramCallable = new c(paramCallable, false, "Task exception on worker thread");
    if (Thread.currentThread() == this.b)
    {
      paramCallable.run();
      return paramCallable;
    }
    a(paramCallable);
    return paramCallable;
  }
  
  public <V> Future<V> zze(Callable<V> paramCallable)
    throws IllegalStateException
  {
    zzob();
    zzac.zzw(paramCallable);
    paramCallable = new c(paramCallable, true, "Task exception on worker thread");
    if (Thread.currentThread() == this.b)
    {
      paramCallable.run();
      return paramCallable;
    }
    a(paramCallable);
    return paramCallable;
  }
  
  public void zzm(Runnable paramRunnable)
    throws IllegalStateException
  {
    zzob();
    zzac.zzw(paramRunnable);
    a(new c(paramRunnable, "Task exception on worker thread"));
  }
  
  public void zzmR()
  {
    if (Thread.currentThread() != this.b) {
      throw new IllegalStateException("Call expected from worker thread");
    }
  }
  
  protected void zzmS() {}
  
  public void zzn(Runnable arg1)
    throws IllegalStateException
  {
    zzob();
    zzac.zzw(???);
    c localc = new c(???, "Task exception on network thread");
    synchronized (this.h)
    {
      this.e.add(localc);
      if (this.c == null)
      {
        this.c = new d("Measurement Network", this.e);
        this.c.setUncaughtExceptionHandler(this.g);
        this.c.start();
        return;
      }
      this.c.a();
    }
  }
  
  static final class a
    extends RuntimeException
  {}
  
  final class b
    implements Thread.UncaughtExceptionHandler
  {
    private final String b;
    
    public b(String paramString)
    {
      zzac.zzw(paramString);
      this.b = paramString;
    }
    
    public final void uncaughtException(Thread paramThread, Throwable paramThrowable)
    {
      try
      {
        zzaud.this.zzKl().zzLY().zzj(this.b, paramThrowable);
        return;
      }
      finally
      {
        paramThread = finally;
        throw paramThread;
      }
    }
  }
  
  final class c<V>
    extends FutureTask<V>
    implements Comparable<c>
  {
    private final long b;
    private final boolean c;
    private final String d;
    
    c(Runnable paramRunnable, String paramString)
    {
      super(null);
      zzac.zzw(paramString);
      this.b = zzaud.b().getAndIncrement();
      this.d = paramString;
      this.c = false;
      if (this.b == Long.MAX_VALUE) {
        zzaud.this.zzKl().zzLY().log("Tasks index overflow");
      }
    }
    
    c(boolean paramBoolean, String paramString)
    {
      super();
      Object localObject;
      zzac.zzw(localObject);
      this.b = zzaud.b().getAndIncrement();
      this.d = ((String)localObject);
      this.c = paramString;
      if (this.b == Long.MAX_VALUE) {
        zzaud.this.zzKl().zzLY().log("Tasks index overflow");
      }
    }
    
    protected final void setException(Throwable paramThrowable)
    {
      zzaud.this.zzKl().zzLY().zzj(this.d, paramThrowable);
      if ((paramThrowable instanceof zzaud.a)) {
        Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), paramThrowable);
      }
      super.setException(paramThrowable);
    }
  }
  
  final class d
    extends Thread
  {
    private final Object b;
    private final BlockingQueue<FutureTask<?>> c;
    
    public d(BlockingQueue<FutureTask<?>> paramBlockingQueue)
    {
      zzac.zzw(paramBlockingQueue);
      Object localObject;
      zzac.zzw(localObject);
      this.b = new Object();
      this.c = ((BlockingQueue)localObject);
      setName(paramBlockingQueue);
    }
    
    private void a(InterruptedException paramInterruptedException)
    {
      zzaud.this.zzKl().zzMa().zzj(String.valueOf(getName()).concat(" was interrupted"), paramInterruptedException);
    }
    
    public final void a()
    {
      synchronized (this.b)
      {
        this.b.notifyAll();
        return;
      }
    }
    
    /* Error */
    public final void run()
    {
      // Byte code:
      //   0: iconst_0
      //   1: istore_1
      //   2: iload_1
      //   3: ifne +27 -> 30
      //   6: aload_0
      //   7: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   10: invokestatic 83	com/google/android/gms/internal/zzaud:a	(Lcom/google/android/gms/internal/zzaud;)Ljava/util/concurrent/Semaphore;
      //   13: invokevirtual 88	java/util/concurrent/Semaphore:acquire	()V
      //   16: iconst_1
      //   17: istore_1
      //   18: goto -16 -> 2
      //   21: astore_3
      //   22: aload_0
      //   23: aload_3
      //   24: invokespecial 90	com/google/android/gms/internal/zzaud$d:a	(Ljava/lang/InterruptedException;)V
      //   27: goto -25 -> 2
      //   30: aload_0
      //   31: getfield 34	com/google/android/gms/internal/zzaud$d:c	Ljava/util/concurrent/BlockingQueue;
      //   34: invokeinterface 96 1 0
      //   39: checkcast 98	java/util/concurrent/FutureTask
      //   42: astore_3
      //   43: aload_3
      //   44: ifnull +66 -> 110
      //   47: aload_3
      //   48: invokevirtual 100	java/util/concurrent/FutureTask:run	()V
      //   51: goto -21 -> 30
      //   54: astore 4
      //   56: aload_0
      //   57: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   60: invokestatic 103	com/google/android/gms/internal/zzaud:c	(Lcom/google/android/gms/internal/zzaud;)Ljava/lang/Object;
      //   63: astore_3
      //   64: aload_3
      //   65: monitorenter
      //   66: aload_0
      //   67: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   70: invokestatic 83	com/google/android/gms/internal/zzaud:a	(Lcom/google/android/gms/internal/zzaud;)Ljava/util/concurrent/Semaphore;
      //   73: invokevirtual 106	java/util/concurrent/Semaphore:release	()V
      //   76: aload_0
      //   77: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   80: invokestatic 103	com/google/android/gms/internal/zzaud:c	(Lcom/google/android/gms/internal/zzaud;)Ljava/lang/Object;
      //   83: invokevirtual 77	java/lang/Object:notifyAll	()V
      //   86: aload_0
      //   87: aload_0
      //   88: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   91: invokestatic 109	com/google/android/gms/internal/zzaud:d	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   94: if_acmpne +212 -> 306
      //   97: aload_0
      //   98: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   101: invokestatic 112	com/google/android/gms/internal/zzaud:e	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   104: pop
      //   105: aload_3
      //   106: monitorexit
      //   107: aload 4
      //   109: athrow
      //   110: aload_0
      //   111: getfield 32	com/google/android/gms/internal/zzaud$d:b	Ljava/lang/Object;
      //   114: astore_3
      //   115: aload_3
      //   116: monitorenter
      //   117: aload_0
      //   118: getfield 34	com/google/android/gms/internal/zzaud$d:c	Ljava/util/concurrent/BlockingQueue;
      //   121: invokeinterface 115 1 0
      //   126: ifnonnull +25 -> 151
      //   129: aload_0
      //   130: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   133: invokestatic 118	com/google/android/gms/internal/zzaud:b	(Lcom/google/android/gms/internal/zzaud;)Z
      //   136: istore_2
      //   137: iload_2
      //   138: ifne +13 -> 151
      //   141: aload_0
      //   142: getfield 32	com/google/android/gms/internal/zzaud$d:b	Ljava/lang/Object;
      //   145: ldc2_w 119
      //   148: invokevirtual 124	java/lang/Object:wait	(J)V
      //   151: aload_3
      //   152: monitorexit
      //   153: aload_0
      //   154: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   157: invokestatic 103	com/google/android/gms/internal/zzaud:c	(Lcom/google/android/gms/internal/zzaud;)Ljava/lang/Object;
      //   160: astore_3
      //   161: aload_3
      //   162: monitorenter
      //   163: aload_0
      //   164: getfield 34	com/google/android/gms/internal/zzaud$d:c	Ljava/util/concurrent/BlockingQueue;
      //   167: invokeinterface 115 1 0
      //   172: ifnonnull +122 -> 294
      //   175: aload_3
      //   176: monitorexit
      //   177: aload_0
      //   178: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   181: invokestatic 103	com/google/android/gms/internal/zzaud:c	(Lcom/google/android/gms/internal/zzaud;)Ljava/lang/Object;
      //   184: astore_3
      //   185: aload_3
      //   186: monitorenter
      //   187: aload_0
      //   188: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   191: invokestatic 83	com/google/android/gms/internal/zzaud:a	(Lcom/google/android/gms/internal/zzaud;)Ljava/util/concurrent/Semaphore;
      //   194: invokevirtual 106	java/util/concurrent/Semaphore:release	()V
      //   197: aload_0
      //   198: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   201: invokestatic 103	com/google/android/gms/internal/zzaud:c	(Lcom/google/android/gms/internal/zzaud;)Ljava/lang/Object;
      //   204: invokevirtual 77	java/lang/Object:notifyAll	()V
      //   207: aload_0
      //   208: aload_0
      //   209: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   212: invokestatic 109	com/google/android/gms/internal/zzaud:d	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   215: if_acmpne +32 -> 247
      //   218: aload_0
      //   219: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   222: invokestatic 112	com/google/android/gms/internal/zzaud:e	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   225: pop
      //   226: aload_3
      //   227: monitorexit
      //   228: return
      //   229: astore 4
      //   231: aload_0
      //   232: aload 4
      //   234: invokespecial 90	com/google/android/gms/internal/zzaud$d:a	(Ljava/lang/InterruptedException;)V
      //   237: goto -86 -> 151
      //   240: astore 4
      //   242: aload_3
      //   243: monitorexit
      //   244: aload 4
      //   246: athrow
      //   247: aload_0
      //   248: aload_0
      //   249: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   252: invokestatic 127	com/google/android/gms/internal/zzaud:f	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   255: if_acmpne +21 -> 276
      //   258: aload_0
      //   259: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   262: invokestatic 130	com/google/android/gms/internal/zzaud:g	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   265: pop
      //   266: goto -40 -> 226
      //   269: astore 4
      //   271: aload_3
      //   272: monitorexit
      //   273: aload 4
      //   275: athrow
      //   276: aload_0
      //   277: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   280: invokevirtual 46	com/google/android/gms/internal/zzaud:zzKl	()Lcom/google/android/gms/internal/zzatx;
      //   283: invokevirtual 133	com/google/android/gms/internal/zzatx:zzLY	()Lcom/google/android/gms/internal/zzatx$zza;
      //   286: ldc -121
      //   288: invokevirtual 138	com/google/android/gms/internal/zzatx$zza:log	(Ljava/lang/String;)V
      //   291: goto -65 -> 226
      //   294: aload_3
      //   295: monitorexit
      //   296: goto -266 -> 30
      //   299: astore 4
      //   301: aload_3
      //   302: monitorexit
      //   303: aload 4
      //   305: athrow
      //   306: aload_0
      //   307: aload_0
      //   308: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   311: invokestatic 127	com/google/android/gms/internal/zzaud:f	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   314: if_acmpne +21 -> 335
      //   317: aload_0
      //   318: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   321: invokestatic 130	com/google/android/gms/internal/zzaud:g	(Lcom/google/android/gms/internal/zzaud;)Lcom/google/android/gms/internal/zzaud$d;
      //   324: pop
      //   325: goto -220 -> 105
      //   328: astore 4
      //   330: aload_3
      //   331: monitorexit
      //   332: aload 4
      //   334: athrow
      //   335: aload_0
      //   336: getfield 18	com/google/android/gms/internal/zzaud$d:a	Lcom/google/android/gms/internal/zzaud;
      //   339: invokevirtual 46	com/google/android/gms/internal/zzaud:zzKl	()Lcom/google/android/gms/internal/zzatx;
      //   342: invokevirtual 133	com/google/android/gms/internal/zzatx:zzLY	()Lcom/google/android/gms/internal/zzatx$zza;
      //   345: ldc -121
      //   347: invokevirtual 138	com/google/android/gms/internal/zzatx$zza:log	(Ljava/lang/String;)V
      //   350: goto -245 -> 105
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	353	0	this	d
      //   1	17	1	i	int
      //   136	2	2	bool	boolean
      //   21	3	3	localInterruptedException1	InterruptedException
      //   54	54	4	localObject2	Object
      //   229	4	4	localInterruptedException2	InterruptedException
      //   240	5	4	localObject3	Object
      //   269	5	4	localObject4	Object
      //   299	5	4	localObject5	Object
      //   328	5	4	localObject6	Object
      // Exception table:
      //   from	to	target	type
      //   6	16	21	java/lang/InterruptedException
      //   30	43	54	finally
      //   47	51	54	finally
      //   110	117	54	finally
      //   153	163	54	finally
      //   244	247	54	finally
      //   303	306	54	finally
      //   141	151	229	java/lang/InterruptedException
      //   117	137	240	finally
      //   141	151	240	finally
      //   151	153	240	finally
      //   231	237	240	finally
      //   242	244	240	finally
      //   187	226	269	finally
      //   226	228	269	finally
      //   247	266	269	finally
      //   271	273	269	finally
      //   276	291	269	finally
      //   163	177	299	finally
      //   294	296	299	finally
      //   301	303	299	finally
      //   66	105	328	finally
      //   105	107	328	finally
      //   306	325	328	finally
      //   330	332	328	finally
      //   335	350	328	finally
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/android/gms/internal/zzaud.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */