b$a.smali

.class public final Lbolts/b$a;
.super Ljava/lang/Object;
.source "SourceFile"

# interfaces
.implements Ljava/util/concurrent/Executor;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lbolts/b;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "a"
.end annotation


# instance fields
.field public a:Ljava/lang/ThreadLocal;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ThreadLocal<",
            "Ljava/lang/Integer;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .registers 2

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ljava/lang/ThreadLocal;

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

    iput-object v0, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    return-void
.end method

.method public static a(Ljava/util/concurrent/ExecutorService;Ljava/lang/Runnable;)V
    .registers 4

    .line 1
    invoke-static {}, Lcom/shopee/app/asm/anr/threadpool/c;->b()Z

    move-result v0

    if-eqz v0, :cond_3a

    invoke-static {}, Lcom/shopee/app/asm/anr/threadpool/c;->a()Z

    move-result v0

    if-eqz v0, :cond_3a

    .line 2
    :try_start_c
    sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;

    .line 3
    sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->b:Landroid/os/Handler;

    new-instance v1, Lcom/shopee/app/asm/anr/threadpool/a$b;

    invoke-direct {v1, p0, p1}, Lcom/shopee/app/asm/anr/threadpool/a$b;-><init>(Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
    :try_end_18
    .catchall {:try_start_c .. :try_end_18} :catchall_19

    goto :goto_54

    :catchall_19
    move-exception v0

    .line 4
    invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;

    .line 5
    :try_start_1f
    invoke-static {p1, p0}, Lcom/shopee/app/asm/anr/threadpool/a;->a(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2b

    .line 6
    sget-object p0, Lcom/shopee/app/asm/fix/threadpool/global/i;->e:Lcom/shopee/app/asm/fix/threadpool/global/j;

    .line 7
    invoke-virtual {p0, p1}, Lcom/shopee/app/asm/anr/threadpool/b;->execute(Ljava/lang/Runnable;)V

    return-void

    .line 8
    :cond_2b
    invoke-interface {p0, p1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
    :try_end_2e
    .catchall {:try_start_1f .. :try_end_2e} :catchall_2f

    goto :goto_54

    :catchall_2f
    move-exception p0

    .line 9
    sget-object p1, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;

    .line 10
    invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;

    move-result-object p1

    invoke-virtual {p1, p0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V

    goto :goto_54

    .line 11
    :cond_3a
    :try_start_3a
    invoke-static {p1, p0}, Lcom/shopee/app/asm/anr/threadpool/a;->a(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_46

    .line 12
    sget-object p0, Lcom/shopee/app/asm/fix/threadpool/global/i;->e:Lcom/shopee/app/asm/fix/threadpool/global/j;

    .line 13
    invoke-virtual {p0, p1}, Lcom/shopee/app/asm/anr/threadpool/b;->execute(Ljava/lang/Runnable;)V

    return-void

    .line 14
    :cond_46
    invoke-interface {p0, p1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
    :try_end_49
    .catchall {:try_start_3a .. :try_end_49} :catchall_4a

    goto :goto_54

    :catchall_4a
    move-exception p0

    .line 15
    sget-object p1, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;

    .line 16
    invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;

    move-result-object p1

    invoke-virtual {p1, p0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V

    :goto_54
    return-void
.end method


# virtual methods
.method public final b()I
    .registers 4

    .line 1
    iget-object v0, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    if-nez v0, :cond_f

    const/4 v0, 0x0

    .line 2
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    .line 3
    :cond_f
    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    add-int/lit8 v0, v0, -0x1

    if-nez v0, :cond_1d

    .line 4
    iget-object v1, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    invoke-virtual {v1}, Ljava/lang/ThreadLocal;->remove()V

    goto :goto_26

    .line 5
    :cond_1d
    iget-object v1, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/ThreadLocal;->set(Ljava/lang/Object;)V

    :goto_26
    return v0
.end method

.method public final execute(Ljava/lang/Runnable;)V
    .registers 5

    .line 1
    iget-object v0, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    if-nez v0, :cond_f

    const/4 v0, 0x0

    .line 2
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    .line 3
    :cond_f
    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    add-int/lit8 v0, v0, 0x1

    .line 4
    iget-object v1, p0, Lbolts/b$a;->a:Ljava/lang/ThreadLocal;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/ThreadLocal;->set(Ljava/lang/Object;)V

    const/16 v1, 0xf

    if-gt v0, v1, :cond_28

    .line 5
    :try_start_22
    invoke-interface {p1}, Ljava/lang/Runnable;->run()V

    goto :goto_2f

    :catchall_26
    move-exception p1

    goto :goto_33

    .line 6
    :cond_28
    sget-object v0, Lbolts/b;->d:Lbolts/b;

    iget-object v0, v0, Lbolts/b;->a:Ljava/util/concurrent/ExecutorService;

    .line 7
    invoke-static {v0, p1}, Lbolts/b$a;->a(Ljava/util/concurrent/ExecutorService;Ljava/lang/Runnable;)V
    :try_end_2f
    .catchall {:try_start_22 .. :try_end_2f} :catchall_26

    .line 8
    :goto_2f
    invoke-virtual {p0}, Lbolts/b$a;->b()I

    return-void

    :goto_33
    invoke-virtual {p0}, Lbolts/b$a;->b()I

    throw p1
.end method