.class public Ln2/c;
.super Ln2/h;
.source ""

# interfaces
.implements Lc3/a;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ln2/c$a;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<E:",
        "Ljava/lang/Object;",
        ">",
        "Ln2/h<",
        "TE;>;",
        "Lc3/a<",
        "TE;>;"
    }
.end annotation


# instance fields
.field public B:Lc3/b;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lc3/b<",
            "TE;>;"
        }
    .end annotation
.end field

.field public C:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "TE;>;"
        }
    .end annotation
.end field

.field public D:I

.field public E:I

.field public F:I

.field public G:Ln2/c$a;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ln2/c<",
            "TE;>.a;"
        }
    .end annotation
.end field


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

    invoke-direct {p0}, Ln2/h;-><init>()V

    new-instance v0, Lc3/b;

    invoke-direct {v0}, Lc3/b;-><init>()V

    iput-object v0, p0, Ln2/c;->B:Lc3/b;

    const/16 v0, 0x100

    iput v0, p0, Ln2/c;->D:I

    const/4 v0, 0x0

    iput v0, p0, Ln2/c;->E:I

    const/4 v0, -0x1

    iput v0, p0, Ln2/c;->F:I

    new-instance v0, Ln2/c$a;

    invoke-direct {v0, p0}, Ln2/c$a;-><init>(Ln2/c;)V

    iput-object v0, p0, Ln2/c;->G:Ln2/c$a;

    return-void
.end method


# virtual methods
.method public A(Ljava/lang/Object;)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TE;)V"
        }
    .end annotation

    .line 1
    iget-object v0, p0, Ln2/c;->C:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->remainingCapacity()I

    move-result v0

    iget v1, p0, Ln2/c;->F:I

    const/4 v2, 0x1

    const/4 v3, 0x0

    if-ge v0, v1, :cond_e

    move v0, v2

    goto :goto_f

    :cond_e
    move v0, v3

    :goto_f
    if-eqz v0, :cond_23

    .line 2
    move-object v0, p1

    check-cast v0, Lk2/c;

    .line 3
    invoke-interface {v0}, Lk2/c;->a()Lb2/b;

    move-result-object v0

    .line 4
    iget v0, v0, Lb2/b;->r:I

    const/16 v1, 0x4e20

    if-gt v0, v1, :cond_1f

    goto :goto_20

    :cond_1f
    move v2, v3

    :goto_20
    if-eqz v2, :cond_23

    return-void

    .line 5
    :cond_23
    move-object v0, p1

    check-cast v0, Lk2/c;

    .line 6
    invoke-interface {v0}, Lk2/c;->e()V

    .line 7
    :try_start_29
    iget-object v0, p0, Ln2/c;->C:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0, p1}, Ljava/util/concurrent/BlockingQueue;->put(Ljava/lang/Object;)V
    :try_end_2e
    .catch Ljava/lang/InterruptedException; {:try_start_29 .. :try_end_2e} :catch_2e

    :catch_2e
    return-void
.end method

.method public e(Ln2/a;)V
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ln2/a<",
            "TE;>;)V"
        }
    .end annotation

    iget v0, p0, Ln2/c;->E:I

    if-nez v0, :cond_27

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Ln2/c;->E:I

    const-string v0, "Attaching appender named ["

    invoke-static {v0}, Landroidx/activity/c;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-interface {p1}, Ln2/a;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "] to AsyncAppender."

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lc3/d;->u(Ljava/lang/String;)V

    iget-object v0, p0, Ln2/c;->B:Lc3/b;

    invoke-virtual {v0, p1}, Lc3/b;->e(Ln2/a;)V

    goto :goto_49

    :cond_27
    const-string v0, "One and only one appender may be attached to AsyncAppender."

    invoke-virtual {p0, v0}, Lc3/d;->w(Ljava/lang/String;)V

    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "Ignoring additional appender named ["

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-interface {p1}, Ln2/a;->getName()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, "]"

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p0, p1}, Lc3/d;->w(Ljava/lang/String;)V

    :goto_49
    return-void
.end method

.method public start()V
    .registers 5

    iget v0, p0, Ln2/c;->E:I

    if-nez v0, :cond_a

    const-string v0, "No attached appenders found."

    invoke-virtual {p0, v0}, Lc3/d;->t(Ljava/lang/String;)V

    return-void

    :cond_a
    iget v0, p0, Ln2/c;->D:I

    const/4 v1, 0x1

    if-ge v0, v1, :cond_27

    const-string v0, "Invalid queue size ["

    invoke-static {v0}, Landroidx/activity/c;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Ln2/c;->D:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v1, "]"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lc3/d;->t(Ljava/lang/String;)V

    return-void

    :cond_27
    new-instance v0, Ljava/util/concurrent/ArrayBlockingQueue;

    iget v2, p0, Ln2/c;->D:I

    invoke-direct {v0, v2}, Ljava/util/concurrent/ArrayBlockingQueue;-><init>(I)V

    iput-object v0, p0, Ln2/c;->C:Ljava/util/concurrent/BlockingQueue;

    iget v0, p0, Ln2/c;->F:I

    const/4 v2, -0x1

    if-ne v0, v2, :cond_3b

    iget v0, p0, Ln2/c;->D:I

    div-int/lit8 v0, v0, 0x5

    iput v0, p0, Ln2/c;->F:I

    :cond_3b
    const-string v0, "Setting discardingThreshold to "

    invoke-static {v0}, Landroidx/activity/c;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v2, p0, Ln2/c;->F:I

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lc3/d;->u(Ljava/lang/String;)V

    iget-object v0, p0, Ln2/c;->G:Ln2/c$a;

    invoke-virtual {v0, v1}, Ljava/lang/Thread;->setDaemon(Z)V

    iget-object v0, p0, Ln2/c;->G:Ln2/c$a;

    const-string v2, "AsyncAppender-Worker-"

    invoke-static {v2}, Landroidx/activity/c;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, p0, Ln2/c;->G:Ln2/c$a;

    invoke-virtual {v3}, Ljava/lang/Thread;->getName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Ljava/lang/Thread;->setName(Ljava/lang/String;)V

    .line 1
    iput-boolean v1, p0, Ln2/h;->v:Z

    .line 2
    iget-object v0, p0, Ln2/c;->G:Ln2/c$a;

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method public stop()V
    .registers 4

    .line 1
    iget-boolean v0, p0, Ln2/h;->v:Z

    if-nez v0, :cond_5

    return-void

    :cond_5
    const/4 v0, 0x0

    .line 2
    iput-boolean v0, p0, Ln2/h;->v:Z

    .line 3
    iget-object v0, p0, Ln2/c;->G:Ln2/c$a;

    invoke-virtual {v0}, Ljava/lang/Thread;->interrupt()V

    :try_start_d
    iget-object v0, p0, Ln2/c;->G:Ln2/c$a;

    const-wide/16 v1, 0x3e8

    invoke-virtual {v0, v1, v2}, Ljava/lang/Thread;->join(J)V
    :try_end_14
    .catch Ljava/lang/InterruptedException; {:try_start_d .. :try_end_14} :catch_15

    goto :goto_1b

    :catch_15
    move-exception v0

    const-string v1, "Failed to join worker thread"

    invoke-virtual {p0, v1, v0}, Lc3/d;->g(Ljava/lang/String;Ljava/lang/Throwable;)V

    :goto_1b
    return-void
.end method
