a.smali

.class public Lokio/a;
.super Lokio/t;
.source "AsyncTimeout.java"


# static fields
.field private static final bYY:J

.field private static final bYZ:J

.field static bZa:Lokio/a;


# instance fields
.field private bZb:Z

.field private bZc:Lokio/a;

.field private bZd:J


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

    .prologue
    .line 50
    sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    const-wide/16 v2, 0x3c

    invoke-virtual {v0, v2, v3}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J

    move-result-wide v0

    sput-wide v0, Lokio/a;->bYY:J

    .line 51
    sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    sget-wide v2, Lokio/a;->bYY:J

    invoke-virtual {v0, v2, v3}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J

    move-result-wide v0

    sput-wide v0, Lokio/a;->bYZ:J

    return-void
.end method

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

    .prologue
    .line 41
    invoke-direct {p0}, Lokio/t;-><init>()V

    return-void
.end method

.method static Sf()Lokio/a;
    .registers 8

    .prologue
    const-wide/32 v6, 0xf4240

    const/4 v0, 0x0

    .line 342
    sget-object v1, Lokio/a;->bZa:Lokio/a;

    iget-object v1, v1, Lokio/a;->bZc:Lokio/a;

    .line 345
    if-nez v1, :cond_2a

    .line 346
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v2

    .line 347
    const-class v1, Lokio/a;

    sget-wide v4, Lokio/a;->bYY:J

    invoke-virtual {v1, v4, v5}, Ljava/lang/Object;->wait(J)V

    .line 348
    sget-object v1, Lokio/a;->bZa:Lokio/a;

    iget-object v1, v1, Lokio/a;->bZc:Lokio/a;

    if-nez v1, :cond_29

    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v4

    sub-long v2, v4, v2

    sget-wide v4, Lokio/a;->bYZ:J

    cmp-long v1, v2, v4

    if-ltz v1, :cond_29

    .line 349
    sget-object v0, Lokio/a;->bZa:Lokio/a;

    .line 368
    :cond_29
    :goto_29
    return-object v0

    .line 353
    :cond_2a
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v2

    .line 3145
    iget-wide v4, v1, Lokio/a;->bZd:J

    sub-long v2, v4, v2

    .line 356
    const-wide/16 v4, 0x0

    cmp-long v4, v2, v4

    if-lez v4, :cond_43

    .line 359
    div-long v4, v2, v6

    .line 360
    mul-long/2addr v6, v4

    sub-long/2addr v2, v6

    .line 361
    const-class v1, Lokio/a;

    long-to-int v2, v2

    invoke-virtual {v1, v4, v5, v2}, Ljava/lang/Object;->wait(JI)V

    goto :goto_29

    .line 366
    :cond_43
    sget-object v2, Lokio/a;->bZa:Lokio/a;

    iget-object v3, v1, Lokio/a;->bZc:Lokio/a;

    iput-object v3, v2, Lokio/a;->bZc:Lokio/a;

    .line 367
    iput-object v0, v1, Lokio/a;->bZc:Lokio/a;

    move-object v0, v1

    .line 368
    goto :goto_29
.end method

.method private static declared-synchronized a(Lokio/a;JZ)V
    .registers 13

    .prologue
    const-wide/16 v4, 0x0

    .line 86
    const-class v1, Lokio/a;

    monitor-enter v1

    :try_start_5
    sget-object v0, Lokio/a;->bZa:Lokio/a;

    if-nez v0, :cond_18

    .line 87
    new-instance v0, Lokio/a;

    invoke-direct {v0}, Lokio/a;-><init>()V

    sput-object v0, Lokio/a;->bZa:Lokio/a;

    .line 88
    new-instance v0, Lokio/b;

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

    invoke-virtual {v0}, Lokio/b;->start()V

    .line 91
    :cond_18
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v2

    .line 92
    cmp-long v0, p1, v4

    if-eqz v0, :cond_51

    if-eqz p3, :cond_51

    .line 95
    invoke-virtual {p0}, Lokio/a;->Sv()J

    move-result-wide v4

    sub-long/2addr v4, v2

    invoke-static {p1, p2, v4, v5}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v4

    add-long/2addr v4, v2

    iput-wide v4, p0, Lokio/a;->bZd:J

    .line 1145
    :goto_2e
    iget-wide v4, p0, Lokio/a;->bZd:J

    sub-long/2addr v4, v2

    .line 106
    sget-object v0, Lokio/a;->bZa:Lokio/a;

    .line 107
    :goto_33
    iget-object v6, v0, Lokio/a;->bZc:Lokio/a;

    if-eqz v6, :cond_40

    iget-object v6, v0, Lokio/a;->bZc:Lokio/a;

    .line 2145
    iget-wide v6, v6, Lokio/a;->bZd:J

    sub-long/2addr v6, v2

    .line 107
    cmp-long v6, v4, v6

    if-gez v6, :cond_6c

    .line 108
    :cond_40
    iget-object v2, v0, Lokio/a;->bZc:Lokio/a;

    iput-object v2, p0, Lokio/a;->bZc:Lokio/a;

    .line 109
    iput-object p0, v0, Lokio/a;->bZc:Lokio/a;

    .line 110
    sget-object v2, Lokio/a;->bZa:Lokio/a;

    if-ne v0, v2, :cond_4f

    .line 111
    const-class v0, Lokio/a;

    invoke-virtual {v0}, Ljava/lang/Object;->notify()V
    :try_end_4f
    .catchall {:try_start_5 .. :try_end_4f} :catchall_5a

    .line 116
    :cond_4f
    monitor-exit v1

    return-void

    .line 96
    :cond_51
    cmp-long v0, p1, v4

    if-eqz v0, :cond_5d

    .line 97
    add-long v4, v2, p1

    :try_start_57
    iput-wide v4, p0, Lokio/a;->bZd:J
    :try_end_59
    .catchall {:try_start_57 .. :try_end_59} :catchall_5a

    goto :goto_2e

    .line 86
    :catchall_5a
    move-exception v0

    monitor-exit v1

    throw v0

    .line 98
    :cond_5d
    if-eqz p3, :cond_66

    .line 99
    :try_start_5f
    invoke-virtual {p0}, Lokio/a;->Sv()J

    move-result-wide v4

    iput-wide v4, p0, Lokio/a;->bZd:J

    goto :goto_2e

    .line 101
    :cond_66
    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    .line 106
    :cond_6c
    iget-object v0, v0, Lokio/a;->bZc:Lokio/a;
    :try_end_6e
    .catchall {:try_start_5f .. :try_end_6e} :catchall_5a

    goto :goto_33
.end method

.method private static declared-synchronized a(Lokio/a;)Z
    .registers 4

    .prologue
    .line 128
    const-class v1, Lokio/a;

    monitor-enter v1

    :try_start_3
    sget-object v0, Lokio/a;->bZa:Lokio/a;

    :goto_5
    if-eqz v0, :cond_18

    .line 129
    iget-object v2, v0, Lokio/a;->bZc:Lokio/a;

    if-ne v2, p0, :cond_15

    .line 130
    iget-object v2, p0, Lokio/a;->bZc:Lokio/a;

    iput-object v2, v0, Lokio/a;->bZc:Lokio/a;

    .line 131
    const/4 v0, 0x0

    iput-object v0, p0, Lokio/a;->bZc:Lokio/a;
    :try_end_12
    .catchall {:try_start_3 .. :try_end_12} :catchall_1a

    .line 132
    const/4 v0, 0x0

    .line 137
    :goto_13
    monitor-exit v1

    return v0

    .line 128
    :cond_15
    :try_start_15
    iget-object v0, v0, Lokio/a;->bZc:Lokio/a;
    :try_end_17
    .catchall {:try_start_15 .. :try_end_17} :catchall_1a

    goto :goto_5

    .line 137
    :cond_18
    const/4 v0, 0x1

    goto :goto_13

    .line 128
    :catchall_1a
    move-exception v0

    monitor-exit v1

    throw v0
.end method


# virtual methods
.method protected Hx()V
    .registers 1

    .prologue
    .line 153
    return-void
.end method

.method public final Se()Z
    .registers 3

    .prologue
    const/4 v0, 0x0

    .line 120
    iget-boolean v1, p0, Lokio/a;->bZb:Z

    if-nez v1, :cond_6

    .line 122
    :goto_5
    return v0

    .line 121
    :cond_6
    iput-boolean v0, p0, Lokio/a;->bZb:Z

    .line 122
    invoke-static {p0}, Lokio/a;->a(Lokio/a;)Z

    move-result v0

    goto :goto_5
.end method

.method protected a(Ljava/io/IOException;)Ljava/io/IOException;
    .registers 4

    .prologue
    .line 294
    new-instance v0, Ljava/io/InterruptedIOException;

    const-string v1, "timeout"

    invoke-direct {v0, v1}, Ljava/io/InterruptedIOException;-><init>(Ljava/lang/String;)V

    .line 295
    if-eqz p1, :cond_c

    .line 296
    invoke-virtual {v0, p1}, Ljava/io/InterruptedIOException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    .line 298
    :cond_c
    return-object v0
.end method

.method final bo(Z)V
    .registers 3

    .prologue
    .line 274
    invoke-virtual {p0}, Lokio/a;->Se()Z

    move-result v0

    .line 275
    if-eqz v0, :cond_e

    if-eqz p1, :cond_e

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lokio/a;->a(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object v0

    throw v0

    .line 276
    :cond_e
    return-void
.end method

.method final e(Ljava/io/IOException;)Ljava/io/IOException;
    .registers 3

    .prologue
    .line 284
    invoke-virtual {p0}, Lokio/a;->Se()Z

    move-result v0

    if-nez v0, :cond_7

    .line 285
    :goto_6
    return-object p1

    :cond_7
    invoke-virtual {p0, p1}, Lokio/a;->a(Ljava/io/IOException;)Ljava/io/IOException;

    move-result-object p1

    goto :goto_6
.end method

.method public final enter()V
    .registers 7

    .prologue
    .line 73
    iget-boolean v0, p0, Lokio/a;->bZb:Z

    if-eqz v0, :cond_c

    new-instance v0, Ljava/lang/IllegalStateException;

    const-string v1, "Unbalanced enter/exit"

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

    throw v0

    .line 74
    :cond_c
    invoke-virtual {p0}, Lokio/a;->St()J

    move-result-wide v0

    .line 75
    invoke-virtual {p0}, Lokio/a;->Su()Z

    move-result v2

    .line 76
    const-wide/16 v4, 0x0

    cmp-long v3, v0, v4

    if-nez v3, :cond_1d

    if-nez v2, :cond_1d

    .line 81
    :goto_1c
    return-void

    .line 79
    :cond_1d
    const/4 v3, 0x1

    iput-boolean v3, p0, Lokio/a;->bZb:Z

    .line 80
    invoke-static {p0, v0, v1, v2}, Lokio/a;->a(Lokio/a;JZ)V

    goto :goto_1c
.end method