BehaviorProcessor$BehaviorSubscription.smali
.class final Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;
.super Ljava/util/concurrent/atomic/AtomicLong;
.source "BehaviorProcessor.java"
# interfaces
.implements Lf/b/d;
.implements Lio/reactivex/internal/util/a$a;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lio/reactivex/processors/BehaviorProcessor;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x18
name = "BehaviorSubscription"
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/util/concurrent/atomic/AtomicLong;",
"Lf/b/d;",
"Lio/reactivex/internal/util/a$a<",
"Ljava/lang/Object;",
">;"
}
.end annotation
# static fields
.field private static final serialVersionUID:J = 0x2db3b5785ea03c8eL
# instance fields
.field volatile cancelled:Z
.field final downstream:Lf/b/c;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lf/b/c<",
"-TT;>;"
}
.end annotation
.end field
.field emitting:Z
.field fastPath:Z
.field index:J
.field next:Z
.field queue:Lio/reactivex/internal/util/a;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lio/reactivex/internal/util/a<",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field final state:Lio/reactivex/processors/BehaviorProcessor;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lio/reactivex/processors/BehaviorProcessor<",
"TT;>;"
}
.end annotation
.end field
# direct methods
.method constructor <init>(Lf/b/c;Lio/reactivex/processors/BehaviorProcessor;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lf/b/c<",
"-TT;>;",
"Lio/reactivex/processors/BehaviorProcessor<",
"TT;>;)V"
}
.end annotation
.line 1
invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicLong;-><init>()V
.line 2
iput-object p1, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->downstream:Lf/b/c;
.line 3
iput-object p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->state:Lio/reactivex/processors/BehaviorProcessor;
return-void
.end method
# virtual methods
.method public cancel()V
.registers 2
.line 1
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-nez v0, :cond_c
const/4 v0, 0x1
.line 2
iput-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
.line 3
iget-object v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->state:Lio/reactivex/processors/BehaviorProcessor;
invoke-virtual {v0, p0}, Lio/reactivex/processors/BehaviorProcessor;->b(Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;)V
:cond_c
return-void
.end method
.method emitFirst()V
.registers 5
.line 1
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-eqz v0, :cond_5
return-void
.line 2
:cond_5
monitor-enter p0
.line 3
:try_start_6
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-eqz v0, :cond_c
.line 4
monitor-exit p0
return-void
.line 5
:cond_c
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->next:Z
if-eqz v0, :cond_12
.line 6
monitor-exit p0
return-void
.line 7
:cond_12
iget-object v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->state:Lio/reactivex/processors/BehaviorProcessor;
.line 8
iget-object v1, v0, Lio/reactivex/processors/BehaviorProcessor;->g:Ljava/util/concurrent/locks/Lock;
.line 9
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->lock()V
.line 10
iget-wide v2, v0, Lio/reactivex/processors/BehaviorProcessor;->k:J
iput-wide v2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->index:J
.line 11
iget-object v0, v0, Lio/reactivex/processors/BehaviorProcessor;->i:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
.line 12
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
const/4 v1, 0x1
if-eqz v0, :cond_2b
const/4 v2, 0x1
goto :goto_2c
:cond_2b
const/4 v2, 0x0
.line 13
:goto_2c
iput-boolean v2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->emitting:Z
.line 14
iput-boolean v1, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->next:Z
.line 15
monitor-exit p0
:try_end_31
.catchall {:try_start_6 .. :try_end_31} :catchall_3e
if-eqz v0, :cond_3d
.line 16
invoke-virtual {p0, v0}, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->test(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_3a
return-void
.line 17
:cond_3a
invoke-virtual {p0}, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->emitLoop()V
:cond_3d
return-void
:catchall_3e
move-exception v0
.line 18
:try_start_3f
monitor-exit p0
:try_end_40
.catchall {:try_start_3f .. :try_end_40} :catchall_3e
throw v0
.end method
.method emitLoop()V
.registers 3
.line 1
:goto_0
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-eqz v0, :cond_5
return-void
.line 2
:cond_5
monitor-enter p0
.line 3
:try_start_6
iget-object v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->queue:Lio/reactivex/internal/util/a;
if-nez v0, :cond_f
const/4 v0, 0x0
.line 4
iput-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->emitting:Z
.line 5
monitor-exit p0
return-void
:cond_f
const/4 v1, 0x0
.line 6
iput-object v1, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->queue:Lio/reactivex/internal/util/a;
.line 7
monitor-exit p0
:try_end_13
.catchall {:try_start_6 .. :try_end_13} :catchall_17
.line 8
invoke-virtual {v0, p0}, Lio/reactivex/internal/util/a;->a(Lio/reactivex/internal/util/a$a;)V
goto :goto_0
:catchall_17
move-exception v0
.line 9
:try_start_18
monitor-exit p0
:try_end_19
.catchall {:try_start_18 .. :try_end_19} :catchall_17
goto :goto_1b
:goto_1a
throw v0
:goto_1b
goto :goto_1a
.end method
.method emitNext(Ljava/lang/Object;J)V
.registers 7
.line 1
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-eqz v0, :cond_5
return-void
.line 2
:cond_5
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->fastPath:Z
if-nez v0, :cond_37
.line 3
monitor-enter p0
.line 4
:try_start_a
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
if-eqz v0, :cond_10
.line 5
monitor-exit p0
return-void
.line 6
:cond_10
iget-wide v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->index:J
cmp-long v2, v0, p2
if-nez v2, :cond_18
.line 7
monitor-exit p0
return-void
.line 8
:cond_18
iget-boolean p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->emitting:Z
if-eqz p2, :cond_2d
.line 9
iget-object p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->queue:Lio/reactivex/internal/util/a;
if-nez p2, :cond_28
.line 10
new-instance p2, Lio/reactivex/internal/util/a;
const/4 p3, 0x4
invoke-direct {p2, p3}, Lio/reactivex/internal/util/a;-><init>(I)V
.line 11
iput-object p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->queue:Lio/reactivex/internal/util/a;
.line 12
:cond_28
invoke-virtual {p2, p1}, Lio/reactivex/internal/util/a;->a(Ljava/lang/Object;)V
.line 13
monitor-exit p0
return-void
:cond_2d
const/4 p2, 0x1
.line 14
iput-boolean p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->next:Z
.line 15
monitor-exit p0
:try_end_31
.catchall {:try_start_a .. :try_end_31} :catchall_34
.line 16
iput-boolean p2, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->fastPath:Z
goto :goto_37
:catchall_34
move-exception p1
.line 17
:try_start_35
monitor-exit p0
:try_end_36
.catchall {:try_start_35 .. :try_end_36} :catchall_34
throw p1
.line 18
:cond_37
:goto_37
invoke-virtual {p0, p1}, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->test(Ljava/lang/Object;)Z
return-void
.end method
.method public isFull()Z
.registers 6
.line 1
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-nez v4, :cond_c
const/4 v0, 0x1
goto :goto_d
:cond_c
const/4 v0, 0x0
:goto_d
return v0
.end method
.method public request(J)V
.registers 4
.line 1
invoke-static {p1, p2}, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->validate(J)Z
move-result v0
if-eqz v0, :cond_9
.line 2
invoke-static {p0, p1, p2}, Lio/reactivex/internal/util/b;->a(Ljava/util/concurrent/atomic/AtomicLong;J)J
:cond_9
return-void
.end method
.method public test(Ljava/lang/Object;)Z
.registers 8
.line 1
iget-boolean v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancelled:Z
const/4 v1, 0x1
if-eqz v0, :cond_6
return v1
.line 2
:cond_6
invoke-static {p1}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
.line 3
iget-object p1, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->downstream:Lf/b/c;
invoke-interface {p1}, Lf/b/c;->onComplete()V
return v1
.line 4
:cond_12
invoke-static {p1}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_22
.line 5
iget-object v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->downstream:Lf/b/c;
invoke-static {p1}, Lio/reactivex/internal/util/NotificationLite;->getError(Ljava/lang/Object;)Ljava/lang/Throwable;
move-result-object p1
invoke-interface {v0, p1}, Lf/b/c;->onError(Ljava/lang/Throwable;)V
return v1
.line 6
:cond_22
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
move-result-wide v2
const-wide/16 v4, 0x0
cmp-long v0, v2, v4
if-eqz v0, :cond_42
.line 7
iget-object v0, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->downstream:Lf/b/c;
invoke-static {p1}, Lio/reactivex/internal/util/NotificationLite;->getValue(Ljava/lang/Object;)Ljava/lang/Object;
invoke-interface {v0, p1}, Lf/b/c;->onNext(Ljava/lang/Object;)V
const-wide v0, 0x7fffffffffffffffL
cmp-long p1, v2, v0
if-eqz p1, :cond_40
.line 8
invoke-virtual {p0}, Ljava/util/concurrent/atomic/AtomicLong;->decrementAndGet()J
:cond_40
const/4 p1, 0x0
return p1
.line 9
:cond_42
invoke-virtual {p0}, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->cancel()V
.line 10
iget-object p1, p0, Lio/reactivex/processors/BehaviorProcessor$BehaviorSubscription;->downstream:Lf/b/c;
new-instance v0, Lio/reactivex/exceptions/MissingBackpressureException;
const-string v2, "Could not deliver value due to lack of requests"
invoke-direct {v0, v2}, Lio/reactivex/exceptions/MissingBackpressureException;-><init>(Ljava/lang/String;)V
invoke-interface {p1, v0}, Lf/b/c;->onError(Ljava/lang/Throwable;)V
return v1
.end method