ClientCalls$BlockingResponseStream.smali
.class Lio/grpc/stub/ClientCalls$BlockingResponseStream;
.super Ljava/lang/Object;
.source "ClientCalls.java"
# interfaces
.implements Ljava/util/Iterator;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lio/grpc/stub/ClientCalls;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0xa
name = "BlockingResponseStream"
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/grpc/stub/ClientCalls$BlockingResponseStream$QueuingListener;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Ljava/util/Iterator<",
"TT;>;"
}
.end annotation
# instance fields
.field private final buffer:Ljava/util/concurrent/BlockingQueue;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/BlockingQueue<",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final call:Lio/grpc/ClientCall;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lio/grpc/ClientCall<",
"*TT;>;"
}
.end annotation
.end field
.field private last:Ljava/lang/Object;
.field private final listener:Lio/grpc/ClientCall$Listener;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lio/grpc/ClientCall$Listener<",
"TT;>;"
}
.end annotation
.end field
.field private final threadless:Lio/grpc/stub/ClientCalls$ThreadlessExecutor;
# direct methods
.method private constructor <init>(Lio/grpc/ClientCall;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lio/grpc/ClientCall<",
"*TT;>;)V"
}
.end annotation
const/4 v0, 0x0
.line 3
invoke-direct {p0, p1, v0}, Lio/grpc/stub/ClientCalls$BlockingResponseStream;-><init>(Lio/grpc/ClientCall;Lio/grpc/stub/ClientCalls$ThreadlessExecutor;)V
return-void
.end method
.method synthetic constructor <init>(Lio/grpc/ClientCall;Lio/grpc/stub/ClientCalls$1;)V
.registers 3
.line 1
invoke-direct {p0, p1}, Lio/grpc/stub/ClientCalls$BlockingResponseStream;-><init>(Lio/grpc/ClientCall;)V
return-void
.end method
.method private constructor <init>(Lio/grpc/ClientCall;Lio/grpc/stub/ClientCalls$ThreadlessExecutor;)V
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lio/grpc/ClientCall<",
"*TT;>;",
"Lio/grpc/stub/ClientCalls$ThreadlessExecutor;",
")V"
}
.end annotation
.line 4
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 5
new-instance v0, Ljava/util/concurrent/ArrayBlockingQueue;
const/4 v1, 0x2
invoke-direct {v0, v1}, Ljava/util/concurrent/ArrayBlockingQueue;-><init>(I)V
iput-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->buffer:Ljava/util/concurrent/BlockingQueue;
.line 6
new-instance v0, Lio/grpc/stub/ClientCalls$BlockingResponseStream$QueuingListener;
const/4 v1, 0x0
invoke-direct {v0, p0, v1}, Lio/grpc/stub/ClientCalls$BlockingResponseStream$QueuingListener;-><init>(Lio/grpc/stub/ClientCalls$BlockingResponseStream;Lio/grpc/stub/ClientCalls$1;)V
iput-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->listener:Lio/grpc/ClientCall$Listener;
.line 7
iput-object p1, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->call:Lio/grpc/ClientCall;
.line 8
iput-object p2, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->threadless:Lio/grpc/stub/ClientCalls$ThreadlessExecutor;
return-void
.end method
.method synthetic constructor <init>(Lio/grpc/ClientCall;Lio/grpc/stub/ClientCalls$ThreadlessExecutor;Lio/grpc/stub/ClientCalls$1;)V
.registers 4
.line 2
invoke-direct {p0, p1, p2}, Lio/grpc/stub/ClientCalls$BlockingResponseStream;-><init>(Lio/grpc/ClientCall;Lio/grpc/stub/ClientCalls$ThreadlessExecutor;)V
return-void
.end method
.method static synthetic access$700(Lio/grpc/stub/ClientCalls$BlockingResponseStream;)Ljava/util/concurrent/BlockingQueue;
.registers 1
.line 1
iget-object p0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->buffer:Ljava/util/concurrent/BlockingQueue;
return-object p0
.end method
.method private waitForNext()Ljava/lang/Object;
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;
}
.end annotation
.line 1
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->threadless:Lio/grpc/stub/ClientCalls$ThreadlessExecutor;
if-nez v0, :cond_b
.line 2
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->buffer:Ljava/util/concurrent/BlockingQueue;
invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->take()Ljava/lang/Object;
move-result-object v0
return-object v0
.line 3
:cond_b
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->buffer:Ljava/util/concurrent/BlockingQueue;
invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->poll()Ljava/lang/Object;
move-result-object v0
:goto_11
if-nez v0, :cond_1f
.line 4
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->threadless:Lio/grpc/stub/ClientCalls$ThreadlessExecutor;
invoke-virtual {v0}, Lio/grpc/stub/ClientCalls$ThreadlessExecutor;->waitAndDrain()V
.line 5
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->buffer:Ljava/util/concurrent/BlockingQueue;
invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->poll()Ljava/lang/Object;
move-result-object v0
goto :goto_11
:cond_1f
return-object v0
.end method
# virtual methods
.method public hasNext()Z
.registers 3
.line 1
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
if-nez v0, :cond_1e
.line 2
:try_start_4
invoke-direct {p0}, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->waitForNext()Ljava/lang/Object;
move-result-object v0
iput-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
:try_end_a
.catch Ljava/lang/InterruptedException; {:try_start_4 .. :try_end_a} :catch_b
goto :goto_1e
:catch_b
move-exception v0
.line 3
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Thread;->interrupt()V
.line 4
sget-object v1, Lio/grpc/Status;->CANCELLED:Lio/grpc/Status;
invoke-virtual {v1, v0}, Lio/grpc/Status;->withCause(Ljava/lang/Throwable;)Lio/grpc/Status;
move-result-object v0
invoke-virtual {v0}, Lio/grpc/Status;->asRuntimeException()Lio/grpc/StatusRuntimeException;
move-result-object v0
throw v0
.line 5
:cond_1e
:goto_1e
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
instance-of v1, v0, Lio/grpc/StatusRuntimeException;
if-nez v1, :cond_2a
if-eq v0, p0, :cond_28
const/4 v0, 0x1
goto :goto_29
:cond_28
const/4 v0, 0x0
:goto_29
return v0
.line 6
:cond_2a
check-cast v0, Lio/grpc/StatusRuntimeException;
.line 7
invoke-virtual {v0}, Lio/grpc/StatusRuntimeException;->getStatus()Lio/grpc/Status;
move-result-object v1
invoke-virtual {v0}, Lio/grpc/StatusRuntimeException;->getTrailers()Lio/grpc/Metadata;
move-result-object v0
invoke-virtual {v1, v0}, Lio/grpc/Status;->asRuntimeException(Lio/grpc/Metadata;)Lio/grpc/StatusRuntimeException;
move-result-object v0
throw v0
.end method
.method listener()Lio/grpc/ClientCall$Listener;
.registers 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lio/grpc/ClientCall$Listener<",
"TT;>;"
}
.end annotation
.line 1
iget-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->listener:Lio/grpc/ClientCall$Listener;
return-object v0
.end method
.method public next()Ljava/lang/Object;
.registers 4
.annotation system Ldalvik/annotation/Signature;
value = {
"()TT;"
}
.end annotation
.line 1
invoke-virtual {p0}, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->hasNext()Z
move-result v0
if-eqz v0, :cond_16
const/4 v0, 0x0
.line 2
:try_start_7
iget-object v1, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->call:Lio/grpc/ClientCall;
const/4 v2, 0x1
invoke-virtual {v1, v2}, Lio/grpc/ClientCall;->request(I)V
.line 3
iget-object v1, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
:try_end_f
.catchall {:try_start_7 .. :try_end_f} :catchall_12
.line 4
iput-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
return-object v1
:catchall_12
move-exception v1
iput-object v0, p0, Lio/grpc/stub/ClientCalls$BlockingResponseStream;->last:Ljava/lang/Object;
throw v1
.line 5
:cond_16
new-instance v0, Ljava/util/NoSuchElementException;
invoke-direct {v0}, Ljava/util/NoSuchElementException;-><init>()V
throw v0
.end method
.method public remove()V
.registers 2
.line 1
new-instance v0, Ljava/lang/UnsupportedOperationException;
invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
throw v0
.end method