IOExecutor.smali

.class public Lcom/facebook/react/util/IOExecutor;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field private static ioExecutor:Lcom/facebook/react/util/IOExecutor;


# instance fields
.field private final executor:Ljava/util/concurrent/Executor;


# direct methods
.method private constructor <init>()V
    .registers 4

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

    .line 2
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Runtime;->availableProcessors()I

    move-result v0

    mul-int/lit8 v0, v0, 0x2

    new-instance v1, Lcom/facebook/react/util/IOExecutor$1;

    invoke-direct {v1, p0}, Lcom/facebook/react/util/IOExecutor$1;-><init>(Lcom/facebook/react/util/IOExecutor;)V

    const-string v2, "com/facebook/react/util/IOExecutor"

    invoke-static {v0, v1, v2}, Lcom/facebook/react/util/IOExecutor;->INVOKESTATIC_com_facebook_react_util_IOExecutor_com_shopee_app_asm_fix_threadpool_ExecutorFix_newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    iput-object v0, p0, Lcom/facebook/react/util/IOExecutor;->executor:Ljava/util/concurrent/Executor;

    return-void
.end method

.method public static INVOKEINTERFACE_com_facebook_react_util_IOExecutor_com_shopee_app_asm_anr_threadpool_ExecutorProxy_execute(Ljava/util/concurrent/Executor;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

.method public static INVOKESTATIC_com_facebook_react_util_IOExecutor_com_shopee_app_asm_fix_threadpool_ExecutorFix_newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;
    .registers 4

    .line 1
    sget-object v0, Lcom/shopee/app/asm/fix/threadpool/config/a;->a:Lcom/shopee/app/asm/fix/threadpool/config/a;

    invoke-virtual {v0}, Lcom/shopee/app/asm/fix/threadpool/config/a;->e()Z

    move-result v0

    if-eqz v0, :cond_f

    .line 2
    sget-object p2, Lcom/shopee/app/asm/fix/threadpool/pool/d;->a:Lcom/shopee/app/asm/fix/threadpool/pool/d;

    invoke-virtual {p2, p0, p1}, Lcom/shopee/app/asm/fix/threadpool/pool/d;->d(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object p0

    return-object p0

    .line 3
    :cond_f
    invoke-static {}, Lcom/garena/android/appkit/logging/a;->C()Z

    move-result v0

    if-eqz v0, :cond_1e

    .line 4
    invoke-static {p1, p2}, Lcom/garena/android/appkit/logging/a;->t0(Ljava/util/concurrent/ThreadFactory;Ljava/lang/String;)Ljava/util/concurrent/ThreadFactory;

    move-result-object p1

    .line 5
    invoke-static {p0, p1}, Ljava/util/concurrent/Executors;->newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object p0

    return-object p0

    .line 6
    :cond_1e
    # invokes: Ljava/util/concurrent/Executors;->newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;
    invoke-static {p0, p1}, Lcom/facebook/react/util/IOExecutor;->access$000(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object p0

    return-object p0
.end method

.method public static synthetic access$000(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;
    .registers 2

    invoke-static {p0, p1}, Ljava/util/concurrent/Executors;->newFixedThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object p0

    return-object p0
.end method

.method public static getInstance()Lcom/facebook/react/util/IOExecutor;
    .registers 1

    .line 1
    sget-object v0, Lcom/facebook/react/util/IOExecutor;->ioExecutor:Lcom/facebook/react/util/IOExecutor;

    if-nez v0, :cond_b

    .line 2
    new-instance v0, Lcom/facebook/react/util/IOExecutor;

    invoke-direct {v0}, Lcom/facebook/react/util/IOExecutor;-><init>()V

    sput-object v0, Lcom/facebook/react/util/IOExecutor;->ioExecutor:Lcom/facebook/react/util/IOExecutor;

    .line 3
    :cond_b
    sget-object v0, Lcom/facebook/react/util/IOExecutor;->ioExecutor:Lcom/facebook/react/util/IOExecutor;

    return-object v0
.end method


# virtual methods
.method public post(Ljava/lang/Runnable;)V
    .registers 3

    iget-object v0, p0, Lcom/facebook/react/util/IOExecutor;->executor:Ljava/util/concurrent/Executor;

    invoke-static {v0, p1}, Lcom/facebook/react/util/IOExecutor;->INVOKEINTERFACE_com_facebook_react_util_IOExecutor_com_shopee_app_asm_anr_threadpool_ExecutorProxy_execute(Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V

    return-void
.end method