BackgroundInitializer.smali
.class public abstract Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;
.super Ljava/lang/Object;
.source "BackgroundInitializer.java"
# interfaces
.implements Lorg/apache/commons/lang3/concurrent/ConcurrentInitializer;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lorg/apache/commons/lang3/concurrent/BackgroundInitializer$InitializationTask;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Lorg/apache/commons/lang3/concurrent/ConcurrentInitializer<",
"TT;>;"
}
.end annotation
# instance fields
.field private executor:Ljava/util/concurrent/ExecutorService;
.field private externalExecutor:Ljava/util/concurrent/ExecutorService;
.field private future:Ljava/util/concurrent/Future;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/Future<",
"TT;>;"
}
.end annotation
.end field
# direct methods
.method protected constructor <init>()V
.registers 2
const/4 v0, 0x0
.line 102
invoke-direct {p0, v0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;-><init>(Ljava/util/concurrent/ExecutorService;)V
return-void
.end method
.method protected constructor <init>(Ljava/util/concurrent/ExecutorService;)V
.registers 2
.line 115
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 116
invoke-virtual {p0, p1}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->setExternalExecutor(Ljava/util/concurrent/ExecutorService;)V
return-void
.end method
.method private createExecutor()Ljava/util/concurrent/ExecutorService;
.registers 2
.line 301
invoke-virtual {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->getTaskCount()I
move-result v0
invoke-static {v0}, Ljava/util/concurrent/Executors;->newFixedThreadPool(I)Ljava/util/concurrent/ExecutorService;
move-result-object v0
return-object v0
.end method
.method private createTask(Ljava/util/concurrent/ExecutorService;)Ljava/util/concurrent/Callable;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/ExecutorService;",
")",
"Ljava/util/concurrent/Callable<",
"TT;>;"
}
.end annotation
.line 291
new-instance v0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer$InitializationTask;
invoke-direct {v0, p0, p1}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer$InitializationTask;-><init>(Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;Ljava/util/concurrent/ExecutorService;)V
return-object v0
.end method
# virtual methods
.method public get()Ljava/lang/Object;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"()TT;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lorg/apache/commons/lang3/concurrent/ConcurrentException;
}
.end annotation
.line 212
:try_start_0
invoke-virtual {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->getFuture()Ljava/util/concurrent/Future;
move-result-object v0
invoke-interface {v0}, Ljava/util/concurrent/Future;->get()Ljava/lang/Object;
move-result-object v0
:try_end_8
.catch Ljava/util/concurrent/ExecutionException; {:try_start_0 .. :try_end_8} :catch_17
.catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_8} :catch_9
return-object v0
:catch_9
move-exception v0
.line 218
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Thread;->interrupt()V
.line 219
new-instance v1, Lorg/apache/commons/lang3/concurrent/ConcurrentException;
invoke-direct {v1, v0}, Lorg/apache/commons/lang3/concurrent/ConcurrentException;-><init>(Ljava/lang/Throwable;)V
throw v1
:catch_17
move-exception v0
.line 214
invoke-static {v0}, Lorg/apache/commons/lang3/concurrent/ConcurrentUtils;->handleCause(Ljava/util/concurrent/ExecutionException;)V
const/4 v0, 0x0
return-object v0
.end method
.method protected final declared-synchronized getActiveExecutor()Ljava/util/concurrent/ExecutorService;
.registers 2
monitor-enter p0
.line 249
:try_start_1
iget-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->executor:Ljava/util/concurrent/ExecutorService;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_5
monitor-exit p0
return-object v0
:catchall_5
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized getExternalExecutor()Ljava/util/concurrent/ExecutorService;
.registers 2
monitor-enter p0
.line 125
:try_start_1
iget-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->externalExecutor:Ljava/util/concurrent/ExecutorService;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_5
monitor-exit p0
return-object v0
:catchall_5
move-exception v0
monitor-exit p0
throw v0
.end method
.method public declared-synchronized getFuture()Ljava/util/concurrent/Future;
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/concurrent/Future<",
"TT;>;"
}
.end annotation
monitor-enter p0
.line 232
:try_start_1
iget-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->future:Ljava/util/concurrent/Future;
if-eqz v0, :cond_9
.line 236
iget-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->future:Ljava/util/concurrent/Future;
:try_end_7
.catchall {:try_start_1 .. :try_end_7} :catchall_11
monitor-exit p0
return-object v0
.line 233
:cond_9
:try_start_9
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "start() must be called first!"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_11
.catchall {:try_start_9 .. :try_end_11} :catchall_11
:catchall_11
move-exception v0
monitor-exit p0
throw v0
.end method
.method protected getTaskCount()I
.registers 2
const/4 v0, 0x1
return v0
.end method
.method protected abstract initialize()Ljava/lang/Object;
.annotation system Ldalvik/annotation/Signature;
value = {
"()TT;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Exception;
}
.end annotation
.end method
.method public declared-synchronized isStarted()Z
.registers 2
monitor-enter p0
.line 136
:try_start_1
iget-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->future:Ljava/util/concurrent/Future;
:try_end_3
.catchall {:try_start_1 .. :try_end_3} :catchall_a
if-eqz v0, :cond_7
const/4 v0, 0x1
goto :goto_8
:cond_7
const/4 v0, 0x0
:goto_8
monitor-exit p0
return v0
:catchall_a
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized setExternalExecutor(Ljava/util/concurrent/ExecutorService;)V
.registers 3
monitor-enter p0
.line 155
:try_start_1
invoke-virtual {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->isStarted()Z
move-result v0
if-nez v0, :cond_b
.line 160
iput-object p1, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->externalExecutor:Ljava/util/concurrent/ExecutorService;
:try_end_9
.catchall {:try_start_1 .. :try_end_9} :catchall_13
.line 161
monitor-exit p0
return-void
.line 156
:cond_b
:try_start_b
new-instance p1, Ljava/lang/IllegalStateException;
const-string v0, "Cannot set ExecutorService after start()!"
invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:try_end_13
.catchall {:try_start_b .. :try_end_13} :catchall_13
:catchall_13
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized start()Z
.registers 3
monitor-enter p0
.line 175
:try_start_1
invoke-virtual {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->isStarted()Z
move-result v0
if-nez v0, :cond_26
.line 180
invoke-virtual {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->getExternalExecutor()Ljava/util/concurrent/ExecutorService;
move-result-object v0
iput-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->executor:Ljava/util/concurrent/ExecutorService;
if-nez v0, :cond_16
.line 182
invoke-direct {p0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->createExecutor()Ljava/util/concurrent/ExecutorService;
move-result-object v0
iput-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->executor:Ljava/util/concurrent/ExecutorService;
goto :goto_17
:cond_16
const/4 v0, 0x0
.line 187
:goto_17
iget-object v1, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->executor:Ljava/util/concurrent/ExecutorService;
invoke-direct {p0, v0}, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->createTask(Ljava/util/concurrent/ExecutorService;)Ljava/util/concurrent/Callable;
move-result-object v0
invoke-interface {v1, v0}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;
move-result-object v0
iput-object v0, p0, Lorg/apache/commons/lang3/concurrent/BackgroundInitializer;->future:Ljava/util/concurrent/Future;
:try_end_23
.catchall {:try_start_1 .. :try_end_23} :catchall_29
const/4 v0, 0x1
.line 189
monitor-exit p0
return v0
:cond_26
const/4 v0, 0x0
.line 192
monitor-exit p0
return v0
:catchall_29
move-exception v0
monitor-exit p0
throw v0
.end method