AsyncCompletableSubscriber.smali

.class public abstract Lrx/observers/AsyncCompletableSubscriber;
.super Ljava/lang/Object;
.source "AsyncCompletableSubscriber.java"

# interfaces
.implements Lrx/CompletableSubscriber;
.implements Lrx/Subscription;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;
    }
.end annotation


# static fields
.field static final UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;


# instance fields
.field private final upstream:Ljava/util/concurrent/atomic/AtomicReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/atomic/AtomicReference<",
            "Lrx/Subscription;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .line 1
    new-instance v0, Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    invoke-direct {v0}, Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;-><init>()V

    sput-object v0, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    return-void
.end method

.method public constructor <init>()V
    .registers 2

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;

    invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V

    iput-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    return-void
.end method


# virtual methods
.method protected final clear()V
    .registers 3

    .line 1
    iget-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    sget-object v1, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->set(Ljava/lang/Object;)V

    return-void
.end method

.method public final isUnsubscribed()Z
    .registers 3

    .line 1
    iget-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;

    move-result-object v0

    sget-object v1, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    if-ne v0, v1, :cond_c

    const/4 v0, 0x1

    goto :goto_d

    :cond_c
    const/4 v0, 0x0

    :goto_d
    return v0
.end method

.method protected onStart()V
    .registers 1

    return-void
.end method

.method public final onSubscribe(Lrx/Subscription;)V
    .registers 4

    .line 1
    iget-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    const/4 v1, 0x0

    invoke-virtual {v0, v1, p1}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_21

    .line 2
    invoke-interface {p1}, Lrx/Subscription;->unsubscribe()V

    .line 3
    iget-object p1, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;

    move-result-object p1

    sget-object v0, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    if-eq p1, v0, :cond_24

    .line 4
    new-instance p1, Ljava/lang/IllegalStateException;

    const-string v0, "Subscription already set!"

    invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    invoke-static {p1}, Lrx/plugins/RxJavaHooks;->onError(Ljava/lang/Throwable;)V

    goto :goto_24

    .line 5
    :cond_21
    invoke-virtual {p0}, Lrx/observers/AsyncCompletableSubscriber;->onStart()V

    :cond_24
    :goto_24
    return-void
.end method

.method public final unsubscribe()V
    .registers 3

    .line 1
    iget-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrx/Subscription;

    .line 2
    sget-object v1, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    if-eq v0, v1, :cond_1d

    .line 3
    iget-object v0, p0, Lrx/observers/AsyncCompletableSubscriber;->upstream:Ljava/util/concurrent/atomic/AtomicReference;

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrx/Subscription;

    if-eqz v0, :cond_1d

    .line 4
    sget-object v1, Lrx/observers/AsyncCompletableSubscriber;->UNSUBSCRIBED:Lrx/observers/AsyncCompletableSubscriber$Unsubscribed;

    if-eq v0, v1, :cond_1d

    .line 5
    invoke-interface {v0}, Lrx/Subscription;->unsubscribe()V

    :cond_1d
    return-void
.end method