479 lines
11 KiB
Smali
479 lines
11 KiB
Smali
.class public Ll0/l/c/g;
|
|
.super Lrx/Scheduler$Worker;
|
|
.source "NewThreadWorker.java"
|
|
|
|
# interfaces
|
|
.implements Lrx/Subscription;
|
|
|
|
|
|
# static fields
|
|
.field public static final f:Z
|
|
|
|
.field public static final g:I
|
|
|
|
.field public static final h:Ljava/util/concurrent/ConcurrentHashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/ConcurrentHashMap<",
|
|
"Ljava/util/concurrent/ScheduledThreadPoolExecutor;",
|
|
"Ljava/util/concurrent/ScheduledThreadPoolExecutor;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public static final i:Ljava/util/concurrent/atomic/AtomicReference;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/atomic/AtomicReference<",
|
|
"Ljava/util/concurrent/ScheduledExecutorService;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public static volatile j:Ljava/lang/Object;
|
|
|
|
.field public static final k:Ljava/lang/Object;
|
|
|
|
|
|
# instance fields
|
|
.field public final d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
.field public volatile e:Z
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Ljava/lang/Object;
|
|
|
|
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
|
|
|
sput-object v0, Ll0/l/c/g;->k:Ljava/lang/Object;
|
|
|
|
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
|
|
|
|
sput-object v0, Ll0/l/c/g;->h:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
|
|
|
|
sput-object v0, Ll0/l/c/g;->i:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
const-string v0, "rx.scheduler.jdk6.purge-frequency-millis"
|
|
|
|
const/16 v1, 0x3e8
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Integer;->getInteger(Ljava/lang/String;I)Ljava/lang/Integer;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
|
|
|
|
move-result v0
|
|
|
|
sput v0, Ll0/l/c/g;->g:I
|
|
|
|
const-string v0, "rx.scheduler.jdk6.purge-force"
|
|
|
|
invoke-static {v0}, Ljava/lang/Boolean;->getBoolean(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
sget v1, Ll0/l/e/g;->a:I
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
const/16 v0, 0x15
|
|
|
|
if-lt v1, v0, :cond_1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
sput-boolean v0, Ll0/l/c/g;->f:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/util/concurrent/ThreadFactory;)V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Lrx/Scheduler$Worker;-><init>()V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-static {v0, p1}, Ljava/util/concurrent/Executors;->newScheduledThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Ll0/l/c/g;->g(Ljava/util/concurrent/ScheduledExecutorService;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/util/concurrent/ScheduledThreadPoolExecutor;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
move-object v0, p1
|
|
|
|
check-cast v0, Ljava/util/concurrent/ScheduledThreadPoolExecutor;
|
|
|
|
invoke-static {v0}, Ll0/l/c/g;->e(Ljava/util/concurrent/ScheduledThreadPoolExecutor;)V
|
|
|
|
:cond_0
|
|
iput-object p1, p0, Ll0/l/c/g;->d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static d(Ljava/util/concurrent/ScheduledExecutorService;)Ljava/lang/reflect/Method;
|
|
.locals 7
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Class;->getMethods()[Ljava/lang/reflect/Method;
|
|
|
|
move-result-object p0
|
|
|
|
array-length v0, p0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, v0, :cond_1
|
|
|
|
aget-object v3, p0, v2
|
|
|
|
invoke-virtual {v3}, Ljava/lang/reflect/Method;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "setRemoveOnCancelPolicy"
|
|
|
|
invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
invoke-virtual {v3}, Ljava/lang/reflect/Method;->getParameterTypes()[Ljava/lang/Class;
|
|
|
|
move-result-object v4
|
|
|
|
array-length v5, v4
|
|
|
|
const/4 v6, 0x1
|
|
|
|
if-ne v5, v6, :cond_0
|
|
|
|
aget-object v4, v4, v1
|
|
|
|
sget-object v5, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
|
|
|
|
if-ne v4, v5, :cond_0
|
|
|
|
return-object v3
|
|
|
|
:cond_0
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static e(Ljava/util/concurrent/ScheduledThreadPoolExecutor;)V
|
|
.locals 10
|
|
|
|
:goto_0
|
|
sget-object v0, Ll0/l/c/g;->i:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x1
|
|
|
|
new-instance v1, Ll0/l/e/i;
|
|
|
|
const-string v2, "RxSchedulerPurge-"
|
|
|
|
invoke-direct {v1, v2}, Ll0/l/e/i;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-static {v0, v1}, Ljava/util/concurrent/Executors;->newScheduledThreadPool(ILjava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
move-result-object v3
|
|
|
|
sget-object v0, Ll0/l/c/g;->i:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {v0, v1, v3}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
new-instance v4, Ll0/l/c/g$a;
|
|
|
|
invoke-direct {v4}, Ll0/l/c/g$a;-><init>()V
|
|
|
|
sget v0, Ll0/l/c/g;->g:I
|
|
|
|
int-to-long v5, v0
|
|
|
|
int-to-long v7, v0
|
|
|
|
sget-object v9, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-interface/range {v3 .. v9}, Ljava/util/concurrent/ScheduledExecutorService;->scheduleAtFixedRate(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;
|
|
|
|
:goto_1
|
|
sget-object v0, Ll0/l/c/g;->h:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v0, p0, p0}, Ljava/util/concurrent/ConcurrentHashMap;->putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
invoke-interface {v3}, Ljava/util/concurrent/ScheduledExecutorService;->shutdownNow()Ljava/util/List;
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public static g(Ljava/util/concurrent/ScheduledExecutorService;)Z
|
|
.locals 5
|
|
|
|
sget-boolean v0, Ll0/l/c/g;->f:Z
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
instance-of v0, p0, Ljava/util/concurrent/ScheduledThreadPoolExecutor;
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
sget-object v0, Ll0/l/c/g;->j:Ljava/lang/Object;
|
|
|
|
sget-object v2, Ll0/l/c/g;->k:Ljava/lang/Object;
|
|
|
|
if-ne v0, v2, :cond_0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
if-nez v0, :cond_2
|
|
|
|
invoke-static {p0}, Ll0/l/c/g;->d(Ljava/util/concurrent/ScheduledExecutorService;)Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
move-object v2, v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
sget-object v2, Ll0/l/c/g;->k:Ljava/lang/Object;
|
|
|
|
:goto_0
|
|
sput-object v2, Ll0/l/c/g;->j:Ljava/lang/Object;
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
check-cast v0, Ljava/lang/reflect/Method;
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
invoke-static {p0}, Ll0/l/c/g;->d(Ljava/util/concurrent/ScheduledExecutorService;)Ljava/lang/reflect/Method;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_1
|
|
if-eqz v0, :cond_4
|
|
|
|
const/4 v2, 0x1
|
|
|
|
:try_start_0
|
|
new-array v3, v2, [Ljava/lang/Object;
|
|
|
|
sget-object v4, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
|
|
|
|
aput-object v4, v3, v1
|
|
|
|
invoke-virtual {v0, p0, v3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
|
|
:try_end_0
|
|
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_2
|
|
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return v2
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
invoke-static {p0}, Ll0/o/l;->b(Ljava/lang/Throwable;)V
|
|
|
|
goto :goto_2
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
invoke-static {p0}, Ll0/o/l;->b(Ljava/lang/Throwable;)V
|
|
|
|
goto :goto_2
|
|
|
|
:catch_2
|
|
move-exception p0
|
|
|
|
invoke-static {p0}, Ll0/o/l;->b(Ljava/lang/Throwable;)V
|
|
|
|
:cond_4
|
|
:goto_2
|
|
return v1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(Lrx/functions/Action0;)Lrx/Subscription;
|
|
.locals 3
|
|
|
|
iget-boolean v0, p0, Ll0/l/c/g;->e:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget-object p1, Ll0/r/c;->a:Ll0/r/c$a;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-wide/16 v0, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-virtual {p0, p1, v0, v1, v2}, Ll0/l/c/g;->f(Lrx/functions/Action0;JLjava/util/concurrent/TimeUnit;)Ll0/l/c/i;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_0
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public b(Lrx/functions/Action0;JLjava/util/concurrent/TimeUnit;)Lrx/Subscription;
|
|
.locals 1
|
|
|
|
iget-boolean v0, p0, Ll0/l/c/g;->e:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget-object p1, Ll0/r/c;->a:Ll0/r/c$a;
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
invoke-virtual {p0, p1, p2, p3, p4}, Ll0/l/c/g;->f(Lrx/functions/Action0;JLjava/util/concurrent/TimeUnit;)Ll0/l/c/i;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public f(Lrx/functions/Action0;JLjava/util/concurrent/TimeUnit;)Ll0/l/c/i;
|
|
.locals 3
|
|
|
|
invoke-static {p1}, Ll0/o/l;->d(Lrx/functions/Action0;)Lrx/functions/Action0;
|
|
|
|
move-result-object p1
|
|
|
|
new-instance v0, Ll0/l/c/i;
|
|
|
|
invoke-direct {v0, p1}, Ll0/l/c/i;-><init>(Lrx/functions/Action0;)V
|
|
|
|
const-wide/16 v1, 0x0
|
|
|
|
cmp-long p1, p2, v1
|
|
|
|
if-gtz p1, :cond_0
|
|
|
|
iget-object p1, p0, Ll0/l/c/g;->d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
invoke-interface {p1, v0}, Ljava/util/concurrent/ScheduledExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
iget-object p1, p0, Ll0/l/c/g;->d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
invoke-interface {p1, v0, p2, p3, p4}, Ljava/util/concurrent/ScheduledExecutorService;->schedule(Ljava/lang/Runnable;JLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_0
|
|
invoke-virtual {v0, p1}, Ll0/l/c/i;->a(Ljava/util/concurrent/Future;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public isUnsubscribed()Z
|
|
.locals 1
|
|
|
|
iget-boolean v0, p0, Ll0/l/c/g;->e:Z
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public unsubscribe()V
|
|
.locals 2
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Ll0/l/c/g;->e:Z
|
|
|
|
iget-object v0, p0, Ll0/l/c/g;->d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
invoke-interface {v0}, Ljava/util/concurrent/ScheduledExecutorService;->shutdownNow()Ljava/util/List;
|
|
|
|
iget-object v0, p0, Ll0/l/c/g;->d:Ljava/util/concurrent/ScheduledExecutorService;
|
|
|
|
sget-object v1, Ll0/l/c/g;->h:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v1, v0}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
return-void
|
|
.end method
|