n.smali

.class public final Lokhttp3/n;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field static final synthetic b:Z


# instance fields
.field final a:Ljava/util/Deque;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Deque<",
            "Lokhttp3/z$a;",
            ">;"
        }
    .end annotation
.end field

.field private c:I

.field private d:I

.field private e:Ljava/lang/Runnable;

.field private f:Ljava/util/concurrent/ExecutorService;

.field private final g:Ljava/util/Deque;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Deque<",
            "Lokhttp3/z$a;",
            ">;"
        }
    .end annotation
.end field

.field private final h:Ljava/util/Deque;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Deque<",
            "Lokhttp3/z;",
            ">;"
        }
    .end annotation
.end field


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

    .line 39
    const-class v0, Lokhttp3/n;

    invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z

    move-result v0

    xor-int/lit8 v0, v0, 0x1

    sput-boolean v0, Lokhttp3/n;->b:Z

    return-void
.end method

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

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

    const/16 v0, 0x40

    .line 40
    iput v0, p0, Lokhttp3/n;->c:I

    const/4 v0, 0x5

    .line 41
    iput v0, p0, Lokhttp3/n;->d:I

    .line 48
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->a:Ljava/util/Deque;

    .line 51
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    .line 54
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->h:Ljava/util/Deque;

    return-void
.end method

.method public constructor <init>(Ljava/util/concurrent/ExecutorService;)V
    .registers 3

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

    const/16 v0, 0x40

    .line 40
    iput v0, p0, Lokhttp3/n;->c:I

    const/4 v0, 0x5

    .line 41
    iput v0, p0, Lokhttp3/n;->d:I

    .line 48
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->a:Ljava/util/Deque;

    .line 51
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    .line 54
    new-instance v0, Ljava/util/ArrayDeque;

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

    iput-object v0, p0, Lokhttp3/n;->h:Ljava/util/Deque;

    .line 57
    iput-object p1, p0, Lokhttp3/n;->f:Ljava/util/concurrent/ExecutorService;

    return-void
.end method

.method private a(Ljava/util/Deque;Ljava/lang/Object;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/util/Deque<",
            "TT;>;TT;)V"
        }
    .end annotation

    .line 219
    monitor-enter p0

    .line 220
    :try_start_1
    invoke-interface {p1, p2}, Ljava/util/Deque;->remove(Ljava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_16

    .line 221
    iget-object p1, p0, Lokhttp3/n;->e:Ljava/lang/Runnable;

    .line 222
    monitor-exit p0
    :try_end_a
    .catchall {:try_start_1 .. :try_end_a} :catchall_1e

    .line 224
    invoke-virtual {p0}, Lokhttp3/n;->c()Z

    move-result p2

    if-nez p2, :cond_15

    if-eqz p1, :cond_15

    .line 227
    invoke-interface {p1}, Ljava/lang/Runnable;->run()V

    :cond_15
    return-void

    .line 220
    :cond_16
    :try_start_16
    new-instance p1, Ljava/lang/AssertionError;

    const-string p2, "Call wasn\'t in-flight!"

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

    throw p1

    :catchall_1e
    move-exception p1

    .line 222
    monitor-exit p0
    :try_end_20
    .catchall {:try_start_16 .. :try_end_20} :catchall_1e

    throw p1
.end method

.method private b(Lokhttp3/z$a;)I
    .registers 6

    .line 195
    iget-object v0, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    invoke-interface {v0}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;

    move-result-object v0

    const/4 v1, 0x0

    :cond_7
    :goto_7
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_2a

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lokhttp3/z$a;

    .line 4172
    iget-object v3, v2, Lokhttp3/z$a;->c:Lokhttp3/z;

    .line 196
    iget-boolean v3, v3, Lokhttp3/z;->e:Z

    if-nez v3, :cond_7

    .line 197
    invoke-virtual {v2}, Lokhttp3/z$a;->a()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p1}, Lokhttp3/z$a;->a()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_7

    add-int/lit8 v1, v1, 0x1

    goto :goto_7

    :cond_2a
    return v1
.end method


# virtual methods
.method public final declared-synchronized a()Ljava/util/concurrent/ExecutorService;
    .registers 10

    monitor-enter p0

    .line 64
    :try_start_1
    iget-object v0, p0, Lokhttp3/n;->f:Ljava/util/concurrent/ExecutorService;

    if-nez v0, :cond_21

    .line 65
    new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;

    const/4 v2, 0x0

    const v3, 0x7fffffff

    const-wide/16 v4, 0x3c

    sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    new-instance v7, Ljava/util/concurrent/SynchronousQueue;

    invoke-direct {v7}, Ljava/util/concurrent/SynchronousQueue;-><init>()V

    const-string v1, "OkHttp Dispatcher"

    const/4 v8, 0x0

    .line 66
    invoke-static {v1, v8}, Lokhttp3/internal/c;->a(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;

    move-result-object v8

    move-object v1, v0

    invoke-direct/range {v1 .. v8}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V

    iput-object v0, p0, Lokhttp3/n;->f:Ljava/util/concurrent/ExecutorService;

    .line 68
    :cond_21
    iget-object v0, p0, Lokhttp3/n;->f:Ljava/util/concurrent/ExecutorService;
    :try_end_23
    .catchall {:try_start_1 .. :try_end_23} :catchall_25

    monitor-exit p0

    return-object v0

    :catchall_25
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public final a(I)V
    .registers 4

    if-lez p1, :cond_d

    .line 82
    monitor-enter p0

    .line 83
    :try_start_3
    iput p1, p0, Lokhttp3/n;->c:I

    .line 84
    monitor-exit p0
    :try_end_6
    .catchall {:try_start_3 .. :try_end_6} :catchall_a

    .line 85
    invoke-virtual {p0}, Lokhttp3/n;->c()Z

    return-void

    :catchall_a
    move-exception p1

    .line 84
    :try_start_b
    monitor-exit p0
    :try_end_c
    .catchall {:try_start_b .. :try_end_c} :catchall_a

    throw p1

    .line 80
    :cond_d
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object p1

    const-string v1, "max < 1: "

    invoke-virtual {v1, p1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

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

    throw v0
.end method

.method final a(Lokhttp3/z$a;)V
    .registers 3

    .line 209
    iget-object v0, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    invoke-direct {p0, v0, p1}, Lokhttp3/n;->a(Ljava/util/Deque;Ljava/lang/Object;)V

    return-void
.end method

.method final declared-synchronized a(Lokhttp3/z;)V
    .registers 3

    monitor-enter p0

    .line 204
    :try_start_1
    iget-object v0, p0, Lokhttp3/n;->h:Ljava/util/Deque;

    invoke-interface {v0, p1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    .line 205
    monitor-exit p0

    return-void

    :catchall_8
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public final declared-synchronized b()I
    .registers 2

    monitor-enter p0

    .line 89
    :try_start_1
    iget v0, p0, Lokhttp3/n;->c:I
    :try_end_3
    .catchall {:try_start_1 .. :try_end_3} :catchall_5

    monitor-exit p0

    return v0

    :catchall_5
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public final b(I)V
    .registers 4

    if-lez p1, :cond_d

    .line 107
    monitor-enter p0

    .line 108
    :try_start_3
    iput p1, p0, Lokhttp3/n;->d:I

    .line 109
    monitor-exit p0
    :try_end_6
    .catchall {:try_start_3 .. :try_end_6} :catchall_a

    .line 110
    invoke-virtual {p0}, Lokhttp3/n;->c()Z

    return-void

    :catchall_a
    move-exception p1

    .line 109
    :try_start_b
    monitor-exit p0
    :try_end_c
    .catchall {:try_start_b .. :try_end_c} :catchall_a

    throw p1

    .line 105
    :cond_d
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object p1

    const-string v1, "max < 1: "

    invoke-virtual {v1, p1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

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

    throw v0
.end method

.method final b(Lokhttp3/z;)V
    .registers 3

    .line 214
    iget-object v0, p0, Lokhttp3/n;->h:Ljava/util/Deque;

    invoke-direct {p0, v0, p1}, Lokhttp3/n;->a(Ljava/util/Deque;Ljava/lang/Object;)V

    return-void
.end method

.method final c()Z
    .registers 9

    .line 166
    sget-boolean v0, Lokhttp3/n;->b:Z

    if-nez v0, :cond_11

    invoke-static {p0}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_b

    goto :goto_11

    :cond_b
    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    .line 168
    :cond_11
    :goto_11
    new-instance v0, Ljava/util/ArrayList;

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

    .line 170
    monitor-enter p0

    .line 171
    :try_start_17
    iget-object v1, p0, Lokhttp3/n;->a:Ljava/util/Deque;

    invoke-interface {v1}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :cond_1d
    :goto_1d
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_47

    .line 172
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lokhttp3/z$a;

    .line 174
    iget-object v3, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    invoke-interface {v3}, Ljava/util/Deque;->size()I

    move-result v3

    iget v4, p0, Lokhttp3/n;->c:I

    if-ge v3, v4, :cond_47

    .line 175
    invoke-direct {p0, v2}, Lokhttp3/n;->b(Lokhttp3/z$a;)I

    move-result v3

    iget v4, p0, Lokhttp3/n;->d:I

    if-ge v3, v4, :cond_1d

    .line 177
    invoke-interface {v1}, Ljava/util/Iterator;->remove()V

    .line 178
    invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 179
    iget-object v3, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    invoke-interface {v3, v2}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z

    goto :goto_1d

    .line 181
    :cond_47
    invoke-virtual {p0}, Lokhttp3/n;->d()I

    move-result v1

    const/4 v2, 0x0

    if-lez v1, :cond_50

    const/4 v1, 0x1

    goto :goto_51

    :cond_50
    const/4 v1, 0x0

    .line 182
    :goto_51
    monitor-exit p0
    :try_end_52
    .catchall {:try_start_17 .. :try_end_52} :catchall_b3

    .line 184
    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v3

    :goto_56
    if-ge v2, v3, :cond_b2

    .line 185
    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lokhttp3/z$a;

    .line 186
    invoke-virtual {p0}, Lokhttp3/n;->a()Ljava/util/concurrent/ExecutorService;

    move-result-object v5

    .line 1180
    sget-boolean v6, Lokhttp3/z$a;->b:Z

    if-nez v6, :cond_79

    iget-object v6, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    iget-object v6, v6, Lokhttp3/z;->a:Lokhttp3/x;

    .line 1390
    iget-object v6, v6, Lokhttp3/x;->c:Lokhttp3/n;

    .line 1180
    invoke-static {v6}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_73

    goto :goto_79

    :cond_73
    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    .line 1183
    :cond_79
    :goto_79
    :try_start_79
    invoke-interface {v5, v4}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
    :try_end_7c
    .catch Ljava/util/concurrent/RejectedExecutionException; {:try_start_79 .. :try_end_7c} :catch_7f
    .catchall {:try_start_79 .. :try_end_7c} :catchall_7d

    goto :goto_a5

    :catchall_7d
    move-exception v0

    goto :goto_a8

    :catch_7f
    move-exception v5

    .line 1186
    :try_start_80
    new-instance v6, Ljava/io/InterruptedIOException;

    const-string v7, "executor rejected"

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

    .line 1187
    invoke-virtual {v6, v5}, Ljava/io/InterruptedIOException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    .line 1188
    iget-object v5, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    invoke-static {v5}, Lokhttp3/z;->a(Lokhttp3/z;)Lokhttp3/p;

    move-result-object v5

    iget-object v7, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    invoke-virtual {v5, v7, v6}, Lokhttp3/p;->callFailed(Lokhttp3/e;Ljava/io/IOException;)V

    .line 1189
    iget-object v5, v4, Lokhttp3/z$a;->a:Lokhttp3/f;

    iget-object v7, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    invoke-interface {v5, v7, v6}, Lokhttp3/f;->onFailure(Lokhttp3/e;Ljava/io/IOException;)V
    :try_end_9c
    .catchall {:try_start_80 .. :try_end_9c} :catchall_7d

    .line 1192
    iget-object v5, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    iget-object v5, v5, Lokhttp3/z;->a:Lokhttp3/x;

    .line 2390
    iget-object v5, v5, Lokhttp3/x;->c:Lokhttp3/n;

    .line 1192
    invoke-virtual {v5, v4}, Lokhttp3/n;->a(Lokhttp3/z$a;)V

    :goto_a5
    add-int/lit8 v2, v2, 0x1

    goto :goto_56

    :goto_a8
    iget-object v1, v4, Lokhttp3/z$a;->c:Lokhttp3/z;

    iget-object v1, v1, Lokhttp3/z;->a:Lokhttp3/x;

    .line 3390
    iget-object v1, v1, Lokhttp3/x;->c:Lokhttp3/n;

    .line 1192
    invoke-virtual {v1, v4}, Lokhttp3/n;->a(Lokhttp3/z$a;)V

    throw v0

    :cond_b2
    return v1

    :catchall_b3
    move-exception v0

    .line 182
    :try_start_b4
    monitor-exit p0
    :try_end_b5
    .catchall {:try_start_b4 .. :try_end_b5} :catchall_b3

    goto :goto_b7

    :goto_b6
    throw v0

    :goto_b7
    goto :goto_b6
.end method

.method public final declared-synchronized d()I
    .registers 3

    monitor-enter p0

    .line 255
    :try_start_1
    iget-object v0, p0, Lokhttp3/n;->g:Ljava/util/Deque;

    invoke-interface {v0}, Ljava/util/Deque;->size()I

    move-result v0

    iget-object v1, p0, Lokhttp3/n;->h:Ljava/util/Deque;

    invoke-interface {v1}, Ljava/util/Deque;->size()I

    move-result v1
    :try_end_d
    .catchall {:try_start_1 .. :try_end_d} :catchall_10

    add-int/2addr v0, v1

    monitor-exit p0

    return v0

    :catchall_10
    move-exception v0

    monitor-exit p0

    throw v0
.end method