s.smali

.class public final Lokhttp3/s;
.super Ljava/lang/Object;
.source "Dispatcher.java"


# instance fields
.field private bVN:I

.field private bVO:I

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

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

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

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


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

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

    .line 40
    const/16 v0, 0x40

    iput v0, p0, Lokhttp3/s;->bVN:I

    .line 41
    const/4 v0, 0x5

    iput v0, p0, Lokhttp3/s;->bVO:I

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

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

    iput-object v0, p0, Lokhttp3/s;->bVP:Ljava/util/Deque;

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

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

    iput-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

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

    iput-object v0, p0, Lokhttp3/s;->bVR:Ljava/util/Deque;

    .line 61
    return-void
.end method

.method private declared-synchronized QF()Ljava/util/concurrent/ExecutorService;
    .registers 10

    .prologue
    .line 64
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lokhttp3/s;->executorService:Ljava/util/concurrent/ExecutorService;

    if-nez v0, :cond_20

    .line 65
    new-instance v1, 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 v0, "OkHttp Dispatcher"

    const/4 v8, 0x0

    .line 66
    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

    iput-object v1, p0, Lokhttp3/s;->executorService:Ljava/util/concurrent/ExecutorService;

    .line 68
    :cond_20
    iget-object v0, p0, Lokhttp3/s;->executorService:Ljava/util/concurrent/ExecutorService;
    :try_end_22
    .catchall {:try_start_1 .. :try_end_22} :catchall_24

    monitor-exit p0

    return-object v0

    .line 64
    :catchall_24
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method private QG()V
    .registers 5

    .prologue
    .line 157
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    move-result v0

    iget v1, p0, Lokhttp3/s;->bVN:I

    if-lt v0, v1, :cond_b

    .line 171
    :cond_a
    :goto_a
    return-void

    .line 158
    :cond_b
    iget-object v0, p0, Lokhttp3/s;->bVP:Ljava/util/Deque;

    invoke-interface {v0}, Ljava/util/Deque;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_a

    .line 160
    iget-object v0, p0, Lokhttp3/s;->bVP:Ljava/util/Deque;

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

    move-result-object v1

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

    move-result v0

    if-eqz v0, :cond_a

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

    move-result-object v0

    check-cast v0, Lokhttp3/ak;

    .line 163
    invoke-direct {p0, v0}, Lokhttp3/s;->b(Lokhttp3/ak;)I

    move-result v2

    iget v3, p0, Lokhttp3/s;->bVO:I

    if-ge v2, v3, :cond_3c

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

    .line 165
    iget-object v2, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    .line 166
    invoke-direct {p0}, Lokhttp3/s;->QF()Ljava/util/concurrent/ExecutorService;

    move-result-object v2

    invoke-interface {v2, v0}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    .line 169
    :cond_3c
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    move-result v0

    iget v2, p0, Lokhttp3/s;->bVN:I

    if-lt v0, v2, :cond_19

    goto :goto_a
.end method

.method private declared-synchronized QH()I
    .registers 3

    .prologue
    .line 237
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    move-result v0

    iget-object v1, p0, Lokhttp3/s;->bVR:Ljava/util/Deque;

    invoke-interface {v1}, Ljava/util/Deque;->size()I
    :try_end_c
    .catchall {:try_start_1 .. :try_end_c} :catchall_10

    move-result v1

    add-int/2addr v0, v1

    monitor-exit p0

    return v0

    :catchall_10
    move-exception v0

    monitor-exit p0

    throw v0
.end method

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

    .prologue
    .line 201
    monitor-enter p0

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

    move-result v0

    if-nez v0, :cond_12

    new-instance v0, Ljava/lang/AssertionError;

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

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

    throw v0

    .line 206
    :catchall_f
    move-exception v0

    monitor-exit p0
    :try_end_11
    .catchall {:try_start_1 .. :try_end_11} :catchall_f

    throw v0

    .line 203
    :cond_12
    if-eqz p3, :cond_17

    :try_start_14
    invoke-direct {p0}, Lokhttp3/s;->QG()V

    .line 204
    :cond_17
    invoke-direct {p0}, Lokhttp3/s;->QH()I

    .line 206
    monitor-exit p0
    :try_end_1b
    .catchall {:try_start_14 .. :try_end_1b} :catchall_f

    return-void
.end method

.method private b(Lokhttp3/ak;)I
    .registers 6

    .prologue
    .line 175
    const/4 v0, 0x0

    .line 176
    iget-object v1, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    move-result-object v2

    move v1, v0

    :cond_8
    :goto_8
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2c

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

    move-result-object v0

    check-cast v0, Lokhttp3/ak;

    .line 1141
    iget-object v3, v0, Lokhttp3/ak;->bWB:Lokhttp3/aj;

    .line 177
    iget-boolean v3, v3, Lokhttp3/aj;->bwi:Z

    if-nez v3, :cond_8

    .line 178
    invoke-virtual {v0}, Lokhttp3/ak;->Ru()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1}, Lokhttp3/ak;->Ru()Ljava/lang/String;

    move-result-object v3

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

    move-result v0

    if-eqz v0, :cond_2d

    add-int/lit8 v0, v1, 0x1

    :goto_2a
    move v1, v0

    .line 179
    goto :goto_8

    .line 180
    :cond_2c
    return v1

    :cond_2d
    move v0, v1

    goto :goto_2a
.end method


# virtual methods
.method final declared-synchronized a(Lokhttp3/aj;)V
    .registers 3

    .prologue
    .line 185
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lokhttp3/s;->bVR: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 186
    monitor-exit p0

    return-void

    .line 185
    :catchall_8
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method final declared-synchronized a(Lokhttp3/ak;)V
    .registers 4

    .prologue
    .line 130
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    move-result v0

    iget v1, p0, Lokhttp3/s;->bVN:I

    if-ge v0, v1, :cond_21

    invoke-direct {p0, p1}, Lokhttp3/s;->b(Lokhttp3/ak;)I

    move-result v0

    iget v1, p0, Lokhttp3/s;->bVO:I

    if-ge v0, v1, :cond_21

    .line 131
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

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

    .line 132
    invoke-direct {p0}, Lokhttp3/s;->QF()Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    invoke-interface {v0, p1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
    :try_end_1f
    .catchall {:try_start_1 .. :try_end_1f} :catchall_27

    .line 136
    :goto_1f
    monitor-exit p0

    return-void

    .line 134
    :cond_21
    :try_start_21
    iget-object v0, p0, Lokhttp3/s;->bVP:Ljava/util/Deque;

    invoke-interface {v0, p1}, Ljava/util/Deque;->add(Ljava/lang/Object;)Z
    :try_end_26
    .catchall {:try_start_21 .. :try_end_26} :catchall_27

    goto :goto_1f

    .line 130
    :catchall_27
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method final b(Lokhttp3/aj;)V
    .registers 4

    .prologue
    .line 195
    iget-object v0, p0, Lokhttp3/s;->bVR:Ljava/util/Deque;

    const/4 v1, 0x0

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

    .line 196
    return-void
.end method

.method final c(Lokhttp3/ak;)V
    .registers 4

    .prologue
    .line 190
    iget-object v0, p0, Lokhttp3/s;->bVQ:Ljava/util/Deque;

    const/4 v1, 0x1

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

    .line 191
    return-void
.end method