PendingPostQueue.smali

.class final Lio/rong/eventbus/PendingPostQueue;
.super Ljava/lang/Object;
.source "PendingPostQueue.java"


# instance fields
.field private head:Lio/rong/eventbus/PendingPost;

.field private tail:Lio/rong/eventbus/PendingPost;


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

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

    return-void
.end method


# virtual methods
.method declared-synchronized enqueue(Lio/rong/eventbus/PendingPost;)V
    .registers 3

    monitor-enter p0

    if-eqz p1, :cond_25

    .line 1
    :try_start_3
    iget-object v0, p0, Lio/rong/eventbus/PendingPostQueue;->tail:Lio/rong/eventbus/PendingPost;

    if-eqz v0, :cond_e

    .line 2
    iget-object v0, p0, Lio/rong/eventbus/PendingPostQueue;->tail:Lio/rong/eventbus/PendingPost;

    iput-object p1, v0, Lio/rong/eventbus/PendingPost;->next:Lio/rong/eventbus/PendingPost;

    .line 3
    iput-object p1, p0, Lio/rong/eventbus/PendingPostQueue;->tail:Lio/rong/eventbus/PendingPost;

    goto :goto_16

    .line 4
    :cond_e
    iget-object v0, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    if-nez v0, :cond_1b

    .line 5
    iput-object p1, p0, Lio/rong/eventbus/PendingPostQueue;->tail:Lio/rong/eventbus/PendingPost;

    iput-object p1, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    .line 6
    :goto_16
    invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
    :try_end_19
    .catchall {:try_start_3 .. :try_end_19} :catchall_23

    .line 7
    monitor-exit p0

    return-void

    .line 8
    :cond_1b
    :try_start_1b
    new-instance p1, Ljava/lang/IllegalStateException;

    const-string v0, "Head present, but no tail"

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

    throw p1

    :catchall_23
    move-exception p1

    goto :goto_2d

    .line 9
    :cond_25
    new-instance p1, Ljava/lang/NullPointerException;

    const-string v0, "null cannot be enqueued"

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

    throw p1
    :try_end_2d
    .catchall {:try_start_1b .. :try_end_2d} :catchall_23

    :goto_2d
    monitor-exit p0

    throw p1
.end method

.method declared-synchronized poll()Lio/rong/eventbus/PendingPost;
    .registers 3

    monitor-enter p0

    .line 1
    :try_start_1
    iget-object v0, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    .line 2
    iget-object v1, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    if-eqz v1, :cond_14

    .line 3
    iget-object v1, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    iget-object v1, v1, Lio/rong/eventbus/PendingPost;->next:Lio/rong/eventbus/PendingPost;

    iput-object v1, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    .line 4
    iget-object v1, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    if-nez v1, :cond_14

    const/4 v1, 0x0

    .line 5
    iput-object v1, p0, Lio/rong/eventbus/PendingPostQueue;->tail:Lio/rong/eventbus/PendingPost;
    :try_end_14
    .catchall {:try_start_1 .. :try_end_14} :catchall_16

    .line 6
    :cond_14
    monitor-exit p0

    return-object v0

    :catchall_16
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized poll(I)Lio/rong/eventbus/PendingPost;
    .registers 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/InterruptedException;
        }
    .end annotation

    monitor-enter p0

    .line 7
    :try_start_1
    iget-object v0, p0, Lio/rong/eventbus/PendingPostQueue;->head:Lio/rong/eventbus/PendingPost;

    if-nez v0, :cond_9

    int-to-long v0, p1

    .line 8
    invoke-virtual {p0, v0, v1}, Ljava/lang/Object;->wait(J)V

    .line 9
    :cond_9
    invoke-virtual {p0}, Lio/rong/eventbus/PendingPostQueue;->poll()Lio/rong/eventbus/PendingPost;

    move-result-object p1
    :try_end_d
    .catchall {:try_start_1 .. :try_end_d} :catchall_f

    monitor-exit p0

    return-object p1

    :catchall_f
    move-exception p1

    monitor-exit p0

    throw p1
.end method