.class public final Lz5/gy1;
.super Ljava/lang/Thread;
.source ""


# static fields
.field public static final x:Z


# instance fields
.field public final r:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "Lz5/sy1<",
            "*>;>;"
        }
    .end annotation
.end field

.field public final s:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "Lz5/sy1<",
            "*>;>;"
        }
    .end annotation
.end field

.field public final t:Lz5/fy1;

.field public volatile u:Z

.field public final v:Lcom/google/android/gms/internal/ads/v3;

.field public final w:Lz5/ex0;


# direct methods
.method public static constructor <clinit>()V
    .registers 1

    sget-boolean v0, Lz5/ez1;->a:Z

    sput-boolean v0, Lz5/gy1;->x:Z

    return-void
.end method

.method public constructor <init>(Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/BlockingQueue;Lz5/fy1;Lz5/ex0;)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/concurrent/BlockingQueue<",
            "Lz5/sy1<",
            "*>;>;",
            "Ljava/util/concurrent/BlockingQueue<",
            "Lz5/sy1<",
            "*>;>;",
            "Lz5/fy1;",
            "Lz5/ex0;",
            ")V"
        }
    .end annotation

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lz5/gy1;->u:Z

    iput-object p1, p0, Lz5/gy1;->r:Ljava/util/concurrent/BlockingQueue;

    iput-object p2, p0, Lz5/gy1;->s:Ljava/util/concurrent/BlockingQueue;

    iput-object p3, p0, Lz5/gy1;->t:Lz5/fy1;

    iput-object p4, p0, Lz5/gy1;->w:Lz5/ex0;

    new-instance p1, Lcom/google/android/gms/internal/ads/v3;

    const/4 p3, 0x0

    invoke-direct {p1, p0, p2, p4, p3}, Lcom/google/android/gms/internal/ads/v3;-><init>(Lz5/gy1;Ljava/util/concurrent/BlockingQueue;Lz5/ex0;[B)V

    iput-object p1, p0, Lz5/gy1;->v:Lcom/google/android/gms/internal/ads/v3;

    return-void
.end method


# virtual methods
.method public final a()V
    .registers 15

    iget-object v0, p0, Lz5/gy1;->r:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->take()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lz5/sy1;

    const-string v1, "cache-queue-take"

    invoke-virtual {v0, v1}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lz5/sy1;->zzf(I)V

    const/4 v2, 0x2

    :try_start_12
    invoke-virtual {v0}, Lz5/sy1;->zzm()Z

    iget-object v3, p0, Lz5/gy1;->t:Lz5/fy1;

    invoke-virtual {v0}, Lz5/sy1;->zzj()Ljava/lang/String;

    move-result-object v4

    check-cast v3, Lz5/mz1;

    invoke-virtual {v3, v4}, Lz5/mz1;->a(Ljava/lang/String;)Lz5/ey1;

    move-result-object v3

    if-nez v3, :cond_39

    const-string v1, "cache-miss"

    invoke-virtual {v0, v1}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    iget-object v1, p0, Lz5/gy1;->v:Lcom/google/android/gms/internal/ads/v3;

    invoke-virtual {v1, v0}, Lcom/google/android/gms/internal/ads/v3;->j(Lz5/sy1;)Z

    move-result v1

    if-nez v1, :cond_35

    iget-object v1, p0, Lz5/gy1;->s:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v1, v0}, Ljava/util/concurrent/BlockingQueue;->put(Ljava/lang/Object;)V
    :try_end_35
    .catchall {:try_start_12 .. :try_end_35} :catchall_ea

    :cond_35
    invoke-virtual {v0, v2}, Lz5/sy1;->zzf(I)V

    return-void

    :cond_39
    :try_start_39
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v4

    .line 1
    iget-wide v6, v3, Lz5/ey1;->e:J

    cmp-long v6, v6, v4

    const/4 v7, 0x0

    if-gez v6, :cond_46

    move v6, v1

    goto :goto_47

    :cond_46
    move v6, v7

    :goto_47
    if-eqz v6, :cond_62

    const-string v1, "cache-hit-expired"

    .line 2
    invoke-virtual {v0, v1}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    invoke-virtual {v0, v3}, Lz5/sy1;->zzk(Lz5/ey1;)Lz5/sy1;

    iget-object v1, p0, Lz5/gy1;->v:Lcom/google/android/gms/internal/ads/v3;

    invoke-virtual {v1, v0}, Lcom/google/android/gms/internal/ads/v3;->j(Lz5/sy1;)Z

    move-result v1

    if-nez v1, :cond_5e

    iget-object v1, p0, Lz5/gy1;->s:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v1, v0}, Ljava/util/concurrent/BlockingQueue;->put(Ljava/lang/Object;)V
    :try_end_5e
    .catchall {:try_start_39 .. :try_end_5e} :catchall_ea

    :cond_5e
    invoke-virtual {v0, v2}, Lz5/sy1;->zzf(I)V

    return-void

    :cond_62
    :try_start_62
    const-string v6, "cache-hit"

    invoke-virtual {v0, v6}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    new-instance v6, Lz5/oy1;

    iget-object v10, v3, Lz5/ey1;->a:[B

    iget-object v11, v3, Lz5/ey1;->g:Ljava/util/Map;

    .line 3
    invoke-static {v11}, Lz5/oy1;->a(Ljava/util/Map;)Ljava/util/List;

    move-result-object v12

    const/16 v9, 0xc8

    const/4 v13, 0x0

    move-object v8, v6

    invoke-direct/range {v8 .. v13}, Lz5/oy1;-><init>(I[BLjava/util/Map;Ljava/util/List;Z)V

    .line 4
    invoke-virtual {v0, v6}, Lz5/sy1;->zzs(Lz5/oy1;)Lz5/yy1;

    move-result-object v6

    const-string v8, "cache-hit-parsed"

    invoke-virtual {v0, v8}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    .line 5
    iget-object v8, v6, Lz5/yy1;->c:Lz5/bz1;

    if-nez v8, :cond_86

    move v7, v1

    :cond_86
    const/4 v8, 0x0

    if-nez v7, :cond_be

    const-string v1, "cache-parsing-failed"

    .line 6
    invoke-virtual {v0, v1}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    iget-object v1, p0, Lz5/gy1;->t:Lz5/fy1;

    invoke-virtual {v0}, Lz5/sy1;->zzj()Ljava/lang/String;

    move-result-object v3

    check-cast v1, Lz5/mz1;

    .line 7
    monitor-enter v1
    :try_end_97
    .catchall {:try_start_62 .. :try_end_97} :catchall_ea

    :try_start_97
    invoke-virtual {v1, v3}, Lz5/mz1;->a(Ljava/lang/String;)Lz5/ey1;

    move-result-object v4

    if-eqz v4, :cond_a6

    const-wide/16 v5, 0x0

    iput-wide v5, v4, Lz5/ey1;->f:J

    iput-wide v5, v4, Lz5/ey1;->e:J

    invoke-virtual {v1, v3, v4}, Lz5/mz1;->b(Ljava/lang/String;Lz5/ey1;)V
    :try_end_a6
    .catchall {:try_start_97 .. :try_end_a6} :catchall_bb

    :cond_a6
    :try_start_a6
    monitor-exit v1

    .line 8
    invoke-virtual {v0, v8}, Lz5/sy1;->zzk(Lz5/ey1;)Lz5/sy1;

    iget-object v1, p0, Lz5/gy1;->v:Lcom/google/android/gms/internal/ads/v3;

    invoke-virtual {v1, v0}, Lcom/google/android/gms/internal/ads/v3;->j(Lz5/sy1;)Z

    move-result v1

    if-nez v1, :cond_b7

    iget-object v1, p0, Lz5/gy1;->s:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v1, v0}, Ljava/util/concurrent/BlockingQueue;->put(Ljava/lang/Object;)V
    :try_end_b7
    .catchall {:try_start_a6 .. :try_end_b7} :catchall_ea

    :cond_b7
    invoke-virtual {v0, v2}, Lz5/sy1;->zzf(I)V

    return-void

    :catchall_bb
    move-exception v3

    .line 9
    :try_start_bc
    monitor-exit v1

    throw v3

    .line 10
    :cond_be
    iget-wide v9, v3, Lz5/ey1;->f:J

    cmp-long v4, v9, v4

    if-gez v4, :cond_e1

    const-string v4, "cache-hit-refresh-needed"

    invoke-virtual {v0, v4}, Lz5/sy1;->zzd(Ljava/lang/String;)V

    invoke-virtual {v0, v3}, Lz5/sy1;->zzk(Lz5/ey1;)Lz5/sy1;

    iput-boolean v1, v6, Lz5/yy1;->d:Z

    iget-object v1, p0, Lz5/gy1;->v:Lcom/google/android/gms/internal/ads/v3;

    invoke-virtual {v1, v0}, Lcom/google/android/gms/internal/ads/v3;->j(Lz5/sy1;)Z

    move-result v1

    if-nez v1, :cond_e1

    iget-object v1, p0, Lz5/gy1;->w:Lz5/ex0;

    new-instance v3, Lz5/w8;

    invoke-direct {v3, p0, v0}, Lz5/w8;-><init>(Lz5/gy1;Lz5/sy1;)V

    invoke-virtual {v1, v0, v6, v3}, Lz5/ex0;->l(Lz5/sy1;Lz5/yy1;Ljava/lang/Runnable;)V

    goto :goto_e6

    :cond_e1
    iget-object v1, p0, Lz5/gy1;->w:Lz5/ex0;

    invoke-virtual {v1, v0, v6, v8}, Lz5/ex0;->l(Lz5/sy1;Lz5/yy1;Ljava/lang/Runnable;)V
    :try_end_e6
    .catchall {:try_start_bc .. :try_end_e6} :catchall_ea

    :goto_e6
    invoke-virtual {v0, v2}, Lz5/sy1;->zzf(I)V

    return-void

    :catchall_ea
    move-exception v1

    invoke-virtual {v0, v2}, Lz5/sy1;->zzf(I)V

    throw v1
.end method

.method public final run()V
    .registers 4

    sget-boolean v0, Lz5/gy1;->x:Z

    const/4 v1, 0x0

    if-eqz v0, :cond_c

    new-array v0, v1, [Ljava/lang/Object;

    const-string v2, "start new dispatcher"

    invoke-static {v2, v0}, Lz5/ez1;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    :cond_c
    const/16 v0, 0xa

    invoke-static {v0}, Landroid/os/Process;->setThreadPriority(I)V

    iget-object v0, p0, Lz5/gy1;->t:Lz5/fy1;

    check-cast v0, Lz5/mz1;

    invoke-virtual {v0}, Lz5/mz1;->c()V

    :goto_18
    :try_start_18
    invoke-virtual {p0}, Lz5/gy1;->a()V
    :try_end_1b
    .catch Ljava/lang/InterruptedException; {:try_start_18 .. :try_end_1b} :catch_1c

    goto :goto_18

    :catch_1c
    iget-boolean v0, p0, Lz5/gy1;->u:Z

    if-eqz v0, :cond_28

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Thread;->interrupt()V

    return-void

    :cond_28
    new-array v0, v1, [Ljava/lang/Object;

    const-string v2, "Ignoring spurious interrupt of CacheDispatcher thread; use quit() to terminate it"

    invoke-static {v2, v0}, Lz5/ez1;->c(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_18
.end method
