225 lines
8.9 KiB
Smali
225 lines
8.9 KiB
Smali
.class public final Lcom/google/common/util/concurrent/ExecutionSequencer;
|
|
.super Ljava/lang/Object;
|
|
.source "ExecutionSequencer.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Lcom/google/common/annotations/Beta;
|
|
.end annotation
|
|
|
|
.annotation runtime Lcom/google/common/util/concurrent/ElementTypesAreNonnullByDefault;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/google/common/util/concurrent/ExecutionSequencer$TaskNonReentrantExecutor;,
|
|
Lcom/google/common/util/concurrent/ExecutionSequencer$RunningState;,
|
|
Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private latestTaskQueue:Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
|
|
.field private final ref:Ljava/util/concurrent/atomic/AtomicReference;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/atomic/AtomicReference<",
|
|
"Lcom/google/common/util/concurrent/ListenableFuture<",
|
|
"Ljava/lang/Void;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 2
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 2
|
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
.line 3
|
|
invoke-static {}, Lcom/google/common/util/concurrent/Futures;->immediateVoidFuture()Lcom/google/common/util/concurrent/ListenableFuture;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;-><init>(Ljava/lang/Object;)V
|
|
|
|
iput-object v0, p0, Lcom/google/common/util/concurrent/ExecutionSequencer;->ref:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
.line 4
|
|
new-instance v0, Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, v1}, Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;-><init>(Lcom/google/common/util/concurrent/ExecutionSequencer$1;)V
|
|
|
|
iput-object v0, p0, Lcom/google/common/util/concurrent/ExecutionSequencer;->latestTaskQueue:Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static synthetic access$400(Lcom/google/common/util/concurrent/ExecutionSequencer;)Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
.locals 0
|
|
|
|
.line 1
|
|
iget-object p0, p0, Lcom/google/common/util/concurrent/ExecutionSequencer;->latestTaskQueue:Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic access$402(Lcom/google/common/util/concurrent/ExecutionSequencer;Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;)Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
.locals 0
|
|
|
|
.line 1
|
|
iput-object p1, p0, Lcom/google/common/util/concurrent/ExecutionSequencer;->latestTaskQueue:Lcom/google/common/util/concurrent/ExecutionSequencer$ThreadConfinedTaskQueue;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public static create()Lcom/google/common/util/concurrent/ExecutionSequencer;
|
|
.locals 1
|
|
|
|
.line 1
|
|
new-instance v0, Lcom/google/common/util/concurrent/ExecutionSequencer;
|
|
|
|
invoke-direct {v0}, Lcom/google/common/util/concurrent/ExecutionSequencer;-><init>()V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public submit(Ljava/util/concurrent/Callable;Ljava/util/concurrent/Executor;)Lcom/google/common/util/concurrent/ListenableFuture;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/util/concurrent/Callable<",
|
|
"TT;>;",
|
|
"Ljava/util/concurrent/Executor;",
|
|
")",
|
|
"Lcom/google/common/util/concurrent/ListenableFuture<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p2}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 3
|
|
new-instance v0, Lcom/google/common/util/concurrent/ExecutionSequencer$1;
|
|
|
|
invoke-direct {v0, p0, p1}, Lcom/google/common/util/concurrent/ExecutionSequencer$1;-><init>(Lcom/google/common/util/concurrent/ExecutionSequencer;Ljava/util/concurrent/Callable;)V
|
|
|
|
invoke-virtual {p0, v0, p2}, Lcom/google/common/util/concurrent/ExecutionSequencer;->submitAsync(Lcom/google/common/util/concurrent/AsyncCallable;Ljava/util/concurrent/Executor;)Lcom/google/common/util/concurrent/ListenableFuture;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public submitAsync(Lcom/google/common/util/concurrent/AsyncCallable;Ljava/util/concurrent/Executor;)Lcom/google/common/util/concurrent/ListenableFuture;
|
|
.locals 8
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Lcom/google/common/util/concurrent/AsyncCallable<",
|
|
"TT;>;",
|
|
"Ljava/util/concurrent/Executor;",
|
|
")",
|
|
"Lcom/google/common/util/concurrent/ListenableFuture<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p2}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 3
|
|
new-instance v6, Lcom/google/common/util/concurrent/ExecutionSequencer$TaskNonReentrantExecutor;
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-direct {v6, p2, p0, v0}, Lcom/google/common/util/concurrent/ExecutionSequencer$TaskNonReentrantExecutor;-><init>(Ljava/util/concurrent/Executor;Lcom/google/common/util/concurrent/ExecutionSequencer;Lcom/google/common/util/concurrent/ExecutionSequencer$1;)V
|
|
|
|
.line 4
|
|
new-instance p2, Lcom/google/common/util/concurrent/ExecutionSequencer$2;
|
|
|
|
invoke-direct {p2, p0, v6, p1}, Lcom/google/common/util/concurrent/ExecutionSequencer$2;-><init>(Lcom/google/common/util/concurrent/ExecutionSequencer;Lcom/google/common/util/concurrent/ExecutionSequencer$TaskNonReentrantExecutor;Lcom/google/common/util/concurrent/AsyncCallable;)V
|
|
|
|
.line 5
|
|
invoke-static {}, Lcom/google/common/util/concurrent/SettableFuture;->create()Lcom/google/common/util/concurrent/SettableFuture;
|
|
|
|
move-result-object v3
|
|
|
|
.line 6
|
|
iget-object p1, p0, Lcom/google/common/util/concurrent/ExecutionSequencer;->ref:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
invoke-virtual {p1, v3}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
move-object v4, p1
|
|
|
|
check-cast v4, Lcom/google/common/util/concurrent/ListenableFuture;
|
|
|
|
.line 7
|
|
invoke-static {p2}, Lcom/google/common/util/concurrent/TrustedListenableFutureTask;->create(Lcom/google/common/util/concurrent/AsyncCallable;)Lcom/google/common/util/concurrent/TrustedListenableFutureTask;
|
|
|
|
move-result-object p1
|
|
|
|
.line 8
|
|
invoke-interface {v4, p1, v6}, Lcom/google/common/util/concurrent/ListenableFuture;->addListener(Ljava/lang/Runnable;Ljava/util/concurrent/Executor;)V
|
|
|
|
.line 9
|
|
invoke-static {p1}, Lcom/google/common/util/concurrent/Futures;->nonCancellationPropagating(Lcom/google/common/util/concurrent/ListenableFuture;)Lcom/google/common/util/concurrent/ListenableFuture;
|
|
|
|
move-result-object p2
|
|
|
|
.line 10
|
|
new-instance v7, Lcom/google/common/util/concurrent/ExecutionSequencer$3;
|
|
|
|
move-object v0, v7
|
|
|
|
move-object v1, p0
|
|
|
|
move-object v2, p1
|
|
|
|
move-object v5, p2
|
|
|
|
invoke-direct/range {v0 .. v6}, Lcom/google/common/util/concurrent/ExecutionSequencer$3;-><init>(Lcom/google/common/util/concurrent/ExecutionSequencer;Lcom/google/common/util/concurrent/TrustedListenableFutureTask;Lcom/google/common/util/concurrent/SettableFuture;Lcom/google/common/util/concurrent/ListenableFuture;Lcom/google/common/util/concurrent/ListenableFuture;Lcom/google/common/util/concurrent/ExecutionSequencer$TaskNonReentrantExecutor;)V
|
|
|
|
.line 11
|
|
invoke-static {}, Lcom/google/common/util/concurrent/MoreExecutors;->directExecutor()Ljava/util/concurrent/Executor;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {p2, v7, v0}, Lcom/google/common/util/concurrent/ListenableFuture;->addListener(Ljava/lang/Runnable;Ljava/util/concurrent/Executor;)V
|
|
|
|
.line 12
|
|
invoke-static {}, Lcom/google/common/util/concurrent/MoreExecutors;->directExecutor()Ljava/util/concurrent/Executor;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1, v7, v0}, Lcom/google/common/util/concurrent/FluentFuture$TrustedFuture;->addListener(Ljava/lang/Runnable;Ljava/util/concurrent/Executor;)V
|
|
|
|
return-object p2
|
|
.end method
|