DnsResolver$RequestCanceller.smali

.class Lcom/qiniu/android/dns/dns/DnsResolver$RequestCanceller;
.super Ljava/lang/Object;
.source "DnsResolver.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/qiniu/android/dns/dns/DnsResolver;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "RequestCanceller"
.end annotation


# instance fields
.field cancelActions:Ljava/util/Queue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Queue<",
            "Ljava/lang/Runnable;",
            ">;"
        }
    .end annotation
.end field


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

    return-void
.end method

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

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

    .line 184
    new-instance v0, Ljava/util/concurrent/ConcurrentLinkedQueue;

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

    iput-object v0, p0, Lcom/qiniu/android/dns/dns/DnsResolver$RequestCanceller;->cancelActions:Ljava/util/Queue;

    return-void
.end method


# virtual methods
.method addCancelAction(Ljava/lang/Runnable;)V
    .registers 3
    .param p1, "cancelAction"    # Ljava/lang/Runnable;

    .line 187
    if-eqz p1, :cond_7

    .line 188
    iget-object v0, p0, Lcom/qiniu/android/dns/dns/DnsResolver$RequestCanceller;->cancelActions:Ljava/util/Queue;

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

    .line 190
    :cond_7
    return-void
.end method

.method cancel()V
    .registers 3

    .line 193
    iget-object v0, p0, Lcom/qiniu/android/dns/dns/DnsResolver$RequestCanceller;->cancelActions:Ljava/util/Queue;

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

    move-result-object v0

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

    move-result v1

    if-eqz v1, :cond_18

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

    move-result-object v1

    check-cast v1, Ljava/lang/Runnable;

    .line 194
    .local v1, "cancelAction":Ljava/lang/Runnable;
    if-eqz v1, :cond_17

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

    .line 197
    .end local v1    # "cancelAction":Ljava/lang/Runnable;
    :cond_17
    goto :goto_6

    .line 198
    :cond_18
    return-void
.end method