n.smali

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


# static fields
.field static final synthetic $assertionsDisabled:Z

.field static final executor:Ljava/util/concurrent/Executor;


# instance fields
.field final bVy:Lokhttp3/internal/connection/d;

.field bVz:Z

.field final bwq:I

.field private final bwr:J

.field final bws:Ljava/lang/Runnable;

.field final bwt:Ljava/util/Deque;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Deque",
            "<",
            "Lokhttp3/internal/connection/c;",
            ">;"
        }
    .end annotation
.end field


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

    .prologue
    const/4 v8, 0x1

    const/4 v2, 0x0

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

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

    move-result v0

    if-nez v0, :cond_27

    move v0, v8

    :goto_b
    sput-boolean v0, Lokhttp3/n;->$assertionsDisabled:Z

    .line 50
    new-instance v1, Ljava/util/concurrent/ThreadPoolExecutor;

    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 v0, "OkHttp ConnectionPool"

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

    move-result-object v8

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

    sput-object v1, Lokhttp3/n;->executor:Ljava/util/concurrent/Executor;

    .line 50
    return-void

    :cond_27
    move v0, v2

    .line 44
    goto :goto_b
.end method

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

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

    invoke-direct {p0, v0}, Lokhttp3/n;-><init>(Ljava/util/concurrent/TimeUnit;)V

    .line 87
    return-void
.end method

.method private constructor <init>(Ljava/util/concurrent/TimeUnit;)V
    .registers 6

    .prologue
    const-wide/16 v2, 0x5

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

    .line 57
    new-instance v0, Lokhttp3/n$1;

    invoke-direct {v0, p0}, Lokhttp3/n$1;-><init>(Lokhttp3/n;)V

    iput-object v0, p0, Lokhttp3/n;->bws:Ljava/lang/Runnable;

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

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

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

    .line 77
    new-instance v0, Lokhttp3/internal/connection/d;

    invoke-direct {v0}, Lokhttp3/internal/connection/d;-><init>()V

    iput-object v0, p0, Lokhttp3/n;->bVy:Lokhttp3/internal/connection/d;

    .line 90
    const/4 v0, 0x5

    iput v0, p0, Lokhttp3/n;->bwq:I

    .line 91
    invoke-virtual {p1, v2, v3}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J

    move-result-wide v0

    iput-wide v0, p0, Lokhttp3/n;->bwr:J

    .line 94
    const-wide/16 v0, 0x0

    cmp-long v0, v2, v0

    if-gtz v0, :cond_31

    .line 95
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "keepAliveDuration <= 0: 5"

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

    throw v0

    .line 97
    :cond_31
    return-void
.end method


# virtual methods
.method final H(J)J
    .registers 18

    .prologue
    .line 200
    const/4 v1, 0x0

    .line 201
    const/4 v0, 0x0

    .line 202
    const/4 v6, 0x0

    .line 203
    const-wide/high16 v4, -0x8000000000000000L

    .line 206
    monitor-enter p0

    .line 207
    :try_start_6
    iget-object v2, p0, Lokhttp3/n;->bwt:Ljava/util/Deque;

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

    move-result-object v9

    move v3, v0

    move v8, v1

    :goto_e
    invoke-interface {v9}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_89

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

    move-result-object v0

    check-cast v0, Lokhttp3/internal/connection/c;

    .line 1257
    iget-object v7, v0, Lokhttp3/internal/connection/c;->bBe:Ljava/util/List;

    .line 1258
    const/4 v1, 0x0

    move v2, v1

    :cond_1e
    :goto_1e
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v1

    if-ge v2, v1, :cond_73

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

    move-result-object v1

    check-cast v1, Ljava/lang/ref/Reference;

    .line 1261
    invoke-virtual {v1}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;

    move-result-object v10

    if-eqz v10, :cond_34

    .line 1262
    add-int/lit8 v1, v2, 0x1

    move v2, v1

    .line 1263
    goto :goto_1e

    .line 1267
    :cond_34
    check-cast v1, Lokhttp3/internal/connection/h;

    .line 1269
    new-instance v10, Ljava/lang/StringBuilder;

    const-string v11, "A connection to "

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

    .line 1503
    iget-object v11, v0, Lokhttp3/internal/connection/c;->bXj:Lokhttp3/as;

    .line 2058
    iget-object v11, v11, Lokhttp3/as;->bWU:Lokhttp3/a;

    .line 2093
    iget-object v11, v11, Lokhttp3/a;->bUW:Lokhttp3/HttpUrl;

    .line 1269
    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v10

    const-string v11, " was leaked. Did you forget to close a response body?"

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

    move-result-object v10

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

    move-result-object v10

    .line 1271
    invoke-static {}, Lokhttp3/internal/d/j;->Sc()Lokhttp3/internal/d/j;

    move-result-object v11

    iget-object v1, v1, Lokhttp3/internal/connection/h;->bXq:Ljava/lang/Object;

    invoke-virtual {v11, v10, v1}, Lokhttp3/internal/d/j;->b(Ljava/lang/String;Ljava/lang/Object;)V

    .line 1273
    invoke-interface {v7, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 1274
    const/4 v1, 0x1

    iput-boolean v1, v0, Lokhttp3/internal/connection/c;->bBf:Z

    .line 1277
    invoke-interface {v7}, Ljava/util/List;->isEmpty()Z

    move-result v1

    if-eqz v1, :cond_1e

    .line 1278
    iget-wide v10, p0, Lokhttp3/n;->bwr:J

    sub-long v10, p1, v10

    iput-wide v10, v0, Lokhttp3/internal/connection/c;->bBg:J

    .line 1279
    const/4 v1, 0x0

    .line 211
    :goto_6d
    if-lez v1, :cond_78

    .line 212
    add-int/lit8 v0, v8, 0x1

    move v8, v0

    .line 213
    goto :goto_e

    .line 1283
    :cond_73
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v1

    goto :goto_6d

    .line 216
    :cond_78
    add-int/lit8 v7, v3, 0x1

    .line 219
    iget-wide v2, v0, Lokhttp3/internal/connection/c;->bBg:J

    sub-long v2, p1, v2

    .line 220
    cmp-long v1, v2, v4

    if-lez v1, :cond_b7

    move-wide v12, v2

    move-object v2, v0

    move-wide v0, v12

    :goto_85
    move-wide v4, v0

    move-object v6, v2

    move v3, v7

    .line 224
    goto :goto_e

    .line 226
    :cond_89
    iget-wide v0, p0, Lokhttp3/n;->bwr:J

    cmp-long v0, v4, v0

    if-gez v0, :cond_92

    const/4 v0, 0x5

    if-le v3, v0, :cond_a0

    .line 230
    :cond_92
    iget-object v0, p0, Lokhttp3/n;->bwt:Ljava/util/Deque;

    invoke-interface {v0, v6}, Ljava/util/Deque;->remove(Ljava/lang/Object;)Z

    .line 242
    monitor-exit p0
    :try_end_98
    .catchall {:try_start_6 .. :try_end_98} :catchall_a7

    .line 2512
    iget-object v0, v6, Lokhttp3/internal/connection/c;->socket:Ljava/net/Socket;

    .line 244
    invoke-static {v0}, Lokhttp3/internal/c;->closeQuietly(Ljava/net/Socket;)V

    .line 247
    const-wide/16 v0, 0x0

    :goto_9f
    return-wide v0

    .line 231
    :cond_a0
    if-lez v3, :cond_aa

    .line 233
    :try_start_a2
    iget-wide v0, p0, Lokhttp3/n;->bwr:J

    sub-long/2addr v0, v4

    monitor-exit p0

    goto :goto_9f

    .line 242
    :catchall_a7
    move-exception v0

    monitor-exit p0
    :try_end_a9
    .catchall {:try_start_a2 .. :try_end_a9} :catchall_a7

    throw v0

    .line 234
    :cond_aa
    if-lez v8, :cond_b0

    .line 236
    :try_start_ac
    iget-wide v0, p0, Lokhttp3/n;->bwr:J

    monitor-exit p0

    goto :goto_9f

    .line 239
    :cond_b0
    const/4 v0, 0x0

    iput-boolean v0, p0, Lokhttp3/n;->bVz:Z

    .line 240
    const-wide/16 v0, -0x1

    monitor-exit p0
    :try_end_b6
    .catchall {:try_start_ac .. :try_end_b6} :catchall_a7

    goto :goto_9f

    :cond_b7
    move-wide v0, v4

    move-object v2, v6

    goto :goto_85
.end method