Context$CancellableContext.smali
.class public final Lio/grpc/Context$CancellableContext;
.super Lio/grpc/Context;
.source "Context.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lio/grpc/Context;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = "CancellableContext"
.end annotation
# instance fields
.field private cancellationCause:Ljava/lang/Throwable;
.field private cancelled:Z
.field private pendingDeadline:Ljava/util/concurrent/ScheduledFuture;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/ScheduledFuture<",
"*>;"
}
.end annotation
.end field
.field private final uncancellableSurrogate:Lio/grpc/Context;
# direct methods
.method private constructor <init>(Lio/grpc/Context;)V
.registers 5
.line 3
# getter for: Lio/grpc/Context;->EMPTY_ENTRIES:[[Ljava/lang/Object;
invoke-static {}, Lio/grpc/Context;->access$700()[[Ljava/lang/Object;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x1
invoke-direct {p0, p1, v0, v2, v1}, Lio/grpc/Context;-><init>(Lio/grpc/Context;[[Ljava/lang/Object;ZLio/grpc/Context$1;)V
.line 4
new-instance p1, Lio/grpc/Context;
# getter for: Lio/grpc/Context;->EMPTY_ENTRIES:[[Ljava/lang/Object;
invoke-static {}, Lio/grpc/Context;->access$700()[[Ljava/lang/Object;
move-result-object v0
invoke-direct {p1, p0, v0, v1}, Lio/grpc/Context;-><init>(Lio/grpc/Context;[[Ljava/lang/Object;Lio/grpc/Context$1;)V
iput-object p1, p0, Lio/grpc/Context$CancellableContext;->uncancellableSurrogate:Lio/grpc/Context;
return-void
.end method
.method synthetic constructor <init>(Lio/grpc/Context;Lio/grpc/Context$1;)V
.registers 3
.line 1
invoke-direct {p0, p1}, Lio/grpc/Context$CancellableContext;-><init>(Lio/grpc/Context;)V
return-void
.end method
.method private constructor <init>(Lio/grpc/Context;Lio/grpc/Deadline;Ljava/util/concurrent/ScheduledExecutorService;)V
.registers 7
.line 5
invoke-static {p1, p2}, Lio/grpc/Context$CancellableContext;->deriveDeadline(Lio/grpc/Context;Lio/grpc/Deadline;)[[Ljava/lang/Object;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x1
invoke-direct {p0, p1, v0, v2, v1}, Lio/grpc/Context;-><init>(Lio/grpc/Context;[[Ljava/lang/Object;ZLio/grpc/Context$1;)V
.line 6
# getter for: Lio/grpc/Context;->DEADLINE_KEY:Lio/grpc/Context$Key;
invoke-static {}, Lio/grpc/Context;->access$600()Lio/grpc/Context$Key;
move-result-object p1
invoke-virtual {p1, p0}, Lio/grpc/Context$Key;->get(Lio/grpc/Context;)Ljava/lang/Object;
move-result-object p1
if-ne p1, p2, :cond_2f
.line 7
new-instance p1, Ljava/util/concurrent/TimeoutException;
const-string v0, "context timed out"
invoke-direct {p1, v0}, Ljava/util/concurrent/TimeoutException;-><init>(Ljava/lang/String;)V
.line 8
invoke-virtual {p2}, Lio/grpc/Deadline;->isExpired()Z
move-result v0
if-nez v0, :cond_2c
.line 9
new-instance v0, Lio/grpc/Context$CancellableContext$1;
invoke-direct {v0, p0, p1}, Lio/grpc/Context$CancellableContext$1;-><init>(Lio/grpc/Context$CancellableContext;Ljava/util/concurrent/TimeoutException;)V
invoke-virtual {p2, v0, p3}, Lio/grpc/Deadline;->runOnExpiration(Ljava/lang/Runnable;Ljava/util/concurrent/ScheduledExecutorService;)Ljava/util/concurrent/ScheduledFuture;
move-result-object p1
iput-object p1, p0, Lio/grpc/Context$CancellableContext;->pendingDeadline:Ljava/util/concurrent/ScheduledFuture;
goto :goto_2f
.line 10
:cond_2c
invoke-virtual {p0, p1}, Lio/grpc/Context$CancellableContext;->cancel(Ljava/lang/Throwable;)Z
.line 11
:cond_2f
:goto_2f
new-instance p1, Lio/grpc/Context;
# getter for: Lio/grpc/Context;->EMPTY_ENTRIES:[[Ljava/lang/Object;
invoke-static {}, Lio/grpc/Context;->access$700()[[Ljava/lang/Object;
move-result-object p2
invoke-direct {p1, p0, p2, v1}, Lio/grpc/Context;-><init>(Lio/grpc/Context;[[Ljava/lang/Object;Lio/grpc/Context$1;)V
iput-object p1, p0, Lio/grpc/Context$CancellableContext;->uncancellableSurrogate:Lio/grpc/Context;
return-void
.end method
.method synthetic constructor <init>(Lio/grpc/Context;Lio/grpc/Deadline;Ljava/util/concurrent/ScheduledExecutorService;Lio/grpc/Context$1;)V
.registers 5
.line 2
invoke-direct {p0, p1, p2, p3}, Lio/grpc/Context$CancellableContext;-><init>(Lio/grpc/Context;Lio/grpc/Deadline;Ljava/util/concurrent/ScheduledExecutorService;)V
return-void
.end method
.method private static deriveDeadline(Lio/grpc/Context;Lio/grpc/Deadline;)[[Ljava/lang/Object;
.registers 6
.line 1
# getter for: Lio/grpc/Context;->DEADLINE_KEY:Lio/grpc/Context$Key;
invoke-static {}, Lio/grpc/Context;->access$600()Lio/grpc/Context$Key;
move-result-object v0
invoke-virtual {v0, p0}, Lio/grpc/Context$Key;->get(Lio/grpc/Context;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Lio/grpc/Deadline;
if-eqz p0, :cond_18
.line 2
invoke-virtual {p1, p0}, Lio/grpc/Deadline;->isBefore(Lio/grpc/Deadline;)Z
move-result p0
if-eqz p0, :cond_13
goto :goto_18
.line 3
:cond_13
# getter for: Lio/grpc/Context;->EMPTY_ENTRIES:[[Ljava/lang/Object;
invoke-static {}, Lio/grpc/Context;->access$700()[[Ljava/lang/Object;
move-result-object p0
goto :goto_2a
:cond_18
:goto_18
const/4 p0, 0x1
.line 4
new-array v0, p0, [[Ljava/lang/Object;
const/4 v1, 0x2
new-array v1, v1, [Ljava/lang/Object;
.line 5
# getter for: Lio/grpc/Context;->DEADLINE_KEY:Lio/grpc/Context$Key;
invoke-static {}, Lio/grpc/Context;->access$600()Lio/grpc/Context$Key;
move-result-object v2
const/4 v3, 0x0
aput-object v2, v1, v3
aput-object p1, v1, p0
aput-object v1, v0, v3
move-object p0, v0
:goto_2a
return-object p0
.end method
# virtual methods
.method public attach()Lio/grpc/Context;
.registers 2
.line 1
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->uncancellableSurrogate:Lio/grpc/Context;
invoke-virtual {v0}, Lio/grpc/Context;->attach()Lio/grpc/Context;
move-result-object v0
return-object v0
.end method
.method public cancel(Ljava/lang/Throwable;)Z
.registers 5
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-boolean v0, p0, Lio/grpc/Context$CancellableContext;->cancelled:Z
const/4 v1, 0x1
const/4 v2, 0x0
if-nez v0, :cond_18
.line 3
iput-boolean v1, p0, Lio/grpc/Context$CancellableContext;->cancelled:Z
.line 4
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->pendingDeadline:Ljava/util/concurrent/ScheduledFuture;
if-eqz v0, :cond_15
.line 5
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->pendingDeadline:Ljava/util/concurrent/ScheduledFuture;
invoke-interface {v0, v2}, Ljava/util/concurrent/ScheduledFuture;->cancel(Z)Z
const/4 v0, 0x0
.line 6
iput-object v0, p0, Lio/grpc/Context$CancellableContext;->pendingDeadline:Ljava/util/concurrent/ScheduledFuture;
.line 7
:cond_15
iput-object p1, p0, Lio/grpc/Context$CancellableContext;->cancellationCause:Ljava/lang/Throwable;
goto :goto_19
:cond_18
const/4 v1, 0x0
.line 8
:goto_19
monitor-exit p0
:try_end_1a
.catchall {:try_start_1 .. :try_end_1a} :catchall_20
if-eqz v1, :cond_1f
.line 9
invoke-virtual {p0}, Lio/grpc/Context;->notifyAndClearListeners()V
:cond_1f
return v1
:catchall_20
move-exception p1
.line 10
:try_start_21
monitor-exit p0
:try_end_22
.catchall {:try_start_21 .. :try_end_22} :catchall_20
throw p1
.end method
.method public cancellationCause()Ljava/lang/Throwable;
.registers 2
.line 1
invoke-virtual {p0}, Lio/grpc/Context$CancellableContext;->isCancelled()Z
move-result v0
if-eqz v0, :cond_9
.line 2
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->cancellationCause:Ljava/lang/Throwable;
return-object v0
:cond_9
const/4 v0, 0x0
return-object v0
.end method
.method public detach(Lio/grpc/Context;)V
.registers 3
.line 1
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->uncancellableSurrogate:Lio/grpc/Context;
invoke-virtual {v0, p1}, Lio/grpc/Context;->detach(Lio/grpc/Context;)V
return-void
.end method
.method public detachAndCancel(Lio/grpc/Context;Ljava/lang/Throwable;)V
.registers 3
.line 1
:try_start_0
invoke-virtual {p0, p1}, Lio/grpc/Context$CancellableContext;->detach(Lio/grpc/Context;)V
:try_end_3
.catchall {:try_start_0 .. :try_end_3} :catchall_7
.line 2
invoke-virtual {p0, p2}, Lio/grpc/Context$CancellableContext;->cancel(Ljava/lang/Throwable;)Z
return-void
:catchall_7
move-exception p1
invoke-virtual {p0, p2}, Lio/grpc/Context$CancellableContext;->cancel(Ljava/lang/Throwable;)Z
throw p1
.end method
.method public isCancelled()Z
.registers 3
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-boolean v0, p0, Lio/grpc/Context$CancellableContext;->cancelled:Z
const/4 v1, 0x1
if-eqz v0, :cond_8
.line 3
monitor-exit p0
return v1
.line 4
:cond_8
monitor-exit p0
:try_end_9
.catchall {:try_start_1 .. :try_end_9} :catchall_19
.line 5
invoke-super {p0}, Lio/grpc/Context;->isCancelled()Z
move-result v0
if-eqz v0, :cond_17
.line 6
invoke-super {p0}, Lio/grpc/Context;->cancellationCause()Ljava/lang/Throwable;
move-result-object v0
invoke-virtual {p0, v0}, Lio/grpc/Context$CancellableContext;->cancel(Ljava/lang/Throwable;)Z
return v1
:cond_17
const/4 v0, 0x0
return v0
:catchall_19
move-exception v0
.line 7
:try_start_1a
monitor-exit p0
:try_end_1b
.catchall {:try_start_1a .. :try_end_1b} :catchall_19
throw v0
.end method
.method public isCurrent()Z
.registers 2
.line 1
iget-object v0, p0, Lio/grpc/Context$CancellableContext;->uncancellableSurrogate:Lio/grpc/Context;
invoke-virtual {v0}, Lio/grpc/Context;->isCurrent()Z
move-result v0
return v0
.end method