what-the-bank/sources/io/grpc/internal/ClientCallImpl.java

728 lines
32 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package io.grpc.internal;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.MoreExecutors;
import io.grpc.Attributes;
import io.grpc.CallOptions;
import io.grpc.ClientCall;
import io.grpc.Codec;
import io.grpc.Compressor;
import io.grpc.CompressorRegistry;
import io.grpc.Context;
import io.grpc.Contexts;
import io.grpc.Deadline;
import io.grpc.DecompressorRegistry;
import io.grpc.InternalConfigSelector;
import io.grpc.InternalDecompressorRegistry;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.Status;
import io.grpc.internal.ClientStreamListener;
import io.grpc.internal.ManagedChannelServiceConfig;
import io.grpc.internal.StreamListener;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.concurrent.CancellationException;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import o.C13115fRJ;
import o.C13116fRL;
import o.fRN;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public final class ClientCallImpl<ReqT, RespT> extends ClientCall<ReqT, RespT> {
private final Executor callExecutor;
private final boolean callExecutorIsDirect;
private CallOptions callOptions;
private boolean cancelCalled;
private volatile boolean cancelListenersShouldBeRemoved;
private final CallTracer channelCallsTracer;
private final ClientStreamProvider clientStreamProvider;
private final Context context;
private final ScheduledExecutorService deadlineCancellationExecutor;
private volatile ScheduledFuture<?> deadlineCancellationFuture;
private boolean fullStreamDecompression;
private boolean halfCloseCalled;
private final MethodDescriptor<ReqT, RespT> method;
private ClientStream stream;
private final fRN tag;
private final boolean unaryRequest;
private static final Logger log = Logger.getLogger(ClientCallImpl.class.getName());
private static final byte[] FULL_STREAM_DECOMPRESSION_ENCODINGS = "gzip".getBytes(StandardCharsets.US_ASCII);
private final ClientCallImpl<ReqT, RespT>.ContextCancellationListener cancellationListener = new ContextCancellationListener();
private DecompressorRegistry decompressorRegistry = DecompressorRegistry.getDefaultInstance();
private CompressorRegistry compressorRegistry = CompressorRegistry.getDefaultInstance();
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public interface ClientStreamProvider {
ClientStream newStream(MethodDescriptor<?, ?> methodDescriptor, CallOptions callOptions, Metadata metadata, Context context);
}
/* JADX INFO: Access modifiers changed from: package-private */
public ClientCallImpl(MethodDescriptor<ReqT, RespT> methodDescriptor, Executor executor, CallOptions callOptions, ClientStreamProvider clientStreamProvider, ScheduledExecutorService scheduledExecutorService, CallTracer callTracer, InternalConfigSelector internalConfigSelector) {
this.method = methodDescriptor;
methodDescriptor.getFullMethodName();
this.tag = C13115fRJ.a();
if (executor == MoreExecutors.directExecutor()) {
this.callExecutor = new SerializeReentrantCallsDirectExecutor();
this.callExecutorIsDirect = true;
} else {
this.callExecutor = new SerializingExecutor(executor);
this.callExecutorIsDirect = false;
}
this.channelCallsTracer = callTracer;
this.context = Context.current();
this.unaryRequest = methodDescriptor.getType() == MethodDescriptor.MethodType.UNARY || methodDescriptor.getType() == MethodDescriptor.MethodType.SERVER_STREAMING;
this.callOptions = callOptions;
this.clientStreamProvider = clientStreamProvider;
this.deadlineCancellationExecutor = scheduledExecutorService;
C13115fRJ.c();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public final class ContextCancellationListener implements Context.CancellationListener {
final ClientCallImpl this$0;
private ContextCancellationListener(ClientCallImpl clientCallImpl) {
this.this$0 = clientCallImpl;
}
@Override // io.grpc.Context.CancellationListener
public final void cancelled(Context context) {
this.this$0.stream.cancel(Contexts.statusFromCancelled(context));
}
}
static void prepareHeaders(Metadata metadata, DecompressorRegistry decompressorRegistry, Compressor compressor, boolean z) {
metadata.discardAll(GrpcUtil.CONTENT_LENGTH_KEY);
metadata.discardAll(GrpcUtil.MESSAGE_ENCODING_KEY);
if (compressor != Codec.Identity.NONE) {
metadata.put(GrpcUtil.MESSAGE_ENCODING_KEY, compressor.getMessageEncoding());
}
metadata.discardAll(GrpcUtil.MESSAGE_ACCEPT_ENCODING_KEY);
byte[] rawAdvertisedMessageEncodings = InternalDecompressorRegistry.getRawAdvertisedMessageEncodings(decompressorRegistry);
if (rawAdvertisedMessageEncodings.length != 0) {
metadata.put(GrpcUtil.MESSAGE_ACCEPT_ENCODING_KEY, rawAdvertisedMessageEncodings);
}
metadata.discardAll(GrpcUtil.CONTENT_ENCODING_KEY);
metadata.discardAll(GrpcUtil.CONTENT_ACCEPT_ENCODING_KEY);
if (z) {
metadata.put(GrpcUtil.CONTENT_ACCEPT_ENCODING_KEY, FULL_STREAM_DECOMPRESSION_ENCODINGS);
}
}
@Override // io.grpc.ClientCall
public final void start(ClientCall.Listener<RespT> listener, Metadata metadata) {
C13115fRJ.g();
try {
startInternal(listener, metadata);
} finally {
C13115fRJ.i();
}
}
private void startInternal(ClientCall.Listener<RespT> listener, Metadata metadata) {
Compressor compressor;
Preconditions.checkState(this.stream == null, "Already started");
Preconditions.checkState(!this.cancelCalled, "call was cancelled");
Preconditions.checkNotNull(listener, "observer");
Preconditions.checkNotNull(metadata, "headers");
if (this.context.isCancelled()) {
this.stream = NoopClientStream.INSTANCE;
this.callExecutor.execute(new ContextRunnable(this, listener) { // from class: io.grpc.internal.ClientCallImpl.1ClosedByContext
final ClientCallImpl this$0;
final ClientCall.Listener val$finalObserver;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.context);
this.this$0 = this;
this.val$finalObserver = listener;
}
@Override // io.grpc.internal.ContextRunnable
public void runInContext() {
ClientCallImpl clientCallImpl = this.this$0;
clientCallImpl.closeObserver(this.val$finalObserver, Contexts.statusFromCancelled(clientCallImpl.context), new Metadata());
}
});
return;
}
applyMethodConfig();
String compressor2 = this.callOptions.getCompressor();
if (compressor2 != null) {
compressor = this.compressorRegistry.lookupCompressor(compressor2);
if (compressor == null) {
this.stream = NoopClientStream.INSTANCE;
this.callExecutor.execute(new ContextRunnable(this, listener, compressor2) { // from class: io.grpc.internal.ClientCallImpl.1ClosedByNotFoundCompressor
final ClientCallImpl this$0;
final String val$compressorName;
final ClientCall.Listener val$finalObserver;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.context);
this.this$0 = this;
this.val$finalObserver = listener;
this.val$compressorName = compressor2;
}
@Override // io.grpc.internal.ContextRunnable
public void runInContext() {
this.this$0.closeObserver(this.val$finalObserver, Status.INTERNAL.withDescription(String.format("Unable to find compressor by name %s", this.val$compressorName)), new Metadata());
}
});
return;
}
} else {
compressor = Codec.Identity.NONE;
}
prepareHeaders(metadata, this.decompressorRegistry, compressor, this.fullStreamDecompression);
Deadline effectiveDeadline = effectiveDeadline();
if (effectiveDeadline == null || !effectiveDeadline.isExpired()) {
logIfContextNarrowedTimeout(effectiveDeadline, this.context.getDeadline(), this.callOptions.getDeadline());
this.stream = this.clientStreamProvider.newStream(this.method, this.callOptions, metadata, this.context);
} else {
this.stream = new FailingClientStream(Status.DEADLINE_EXCEEDED.withDescription("ClientCall started after deadline exceeded: ".concat(String.valueOf(effectiveDeadline))), GrpcUtil.getClientStreamTracers(this.callOptions, metadata, 0, false));
}
if (this.callExecutorIsDirect) {
this.stream.optimizeForDirectExecutor();
}
if (this.callOptions.getAuthority() != null) {
this.stream.setAuthority(this.callOptions.getAuthority());
}
if (this.callOptions.getMaxInboundMessageSize() != null) {
this.stream.setMaxInboundMessageSize(this.callOptions.getMaxInboundMessageSize().intValue());
}
if (this.callOptions.getMaxOutboundMessageSize() != null) {
this.stream.setMaxOutboundMessageSize(this.callOptions.getMaxOutboundMessageSize().intValue());
}
if (effectiveDeadline != null) {
this.stream.setDeadline(effectiveDeadline);
}
this.stream.setCompressor(compressor);
boolean z = this.fullStreamDecompression;
if (z) {
this.stream.setFullStreamDecompression(z);
}
this.stream.setDecompressorRegistry(this.decompressorRegistry);
this.channelCallsTracer.reportCallStarted();
this.stream.start(new ClientStreamListenerImpl(this, listener));
this.context.addListener(this.cancellationListener, MoreExecutors.directExecutor());
if (effectiveDeadline != null && !effectiveDeadline.equals(this.context.getDeadline()) && this.deadlineCancellationExecutor != null) {
this.deadlineCancellationFuture = startDeadlineTimer(effectiveDeadline);
}
if (this.cancelListenersShouldBeRemoved) {
removeContextListenerAndCancelDeadlineFuture();
}
}
private void applyMethodConfig() {
ManagedChannelServiceConfig.MethodInfo methodInfo = (ManagedChannelServiceConfig.MethodInfo) this.callOptions.getOption(ManagedChannelServiceConfig.MethodInfo.KEY);
if (methodInfo == null) {
return;
}
if (methodInfo.timeoutNanos != null) {
Deadline after = Deadline.after(methodInfo.timeoutNanos.longValue(), TimeUnit.NANOSECONDS);
Deadline deadline = this.callOptions.getDeadline();
if (deadline == null || after.compareTo(deadline) < 0) {
this.callOptions = this.callOptions.withDeadline(after);
}
}
if (methodInfo.waitForReady != null) {
this.callOptions = methodInfo.waitForReady.booleanValue() ? this.callOptions.withWaitForReady() : this.callOptions.withoutWaitForReady();
}
if (methodInfo.maxInboundMessageSize != null) {
Integer maxInboundMessageSize = this.callOptions.getMaxInboundMessageSize();
if (maxInboundMessageSize != null) {
this.callOptions = this.callOptions.withMaxInboundMessageSize(Math.min(maxInboundMessageSize.intValue(), methodInfo.maxInboundMessageSize.intValue()));
} else {
this.callOptions = this.callOptions.withMaxInboundMessageSize(methodInfo.maxInboundMessageSize.intValue());
}
}
if (methodInfo.maxOutboundMessageSize != null) {
Integer maxOutboundMessageSize = this.callOptions.getMaxOutboundMessageSize();
if (maxOutboundMessageSize != null) {
this.callOptions = this.callOptions.withMaxOutboundMessageSize(Math.min(maxOutboundMessageSize.intValue(), methodInfo.maxOutboundMessageSize.intValue()));
} else {
this.callOptions = this.callOptions.withMaxOutboundMessageSize(methodInfo.maxOutboundMessageSize.intValue());
}
}
}
private static void logIfContextNarrowedTimeout(Deadline deadline, Deadline deadline2, Deadline deadline3) {
Logger logger = log;
if (logger.isLoggable(Level.FINE) && deadline != null && deadline.equals(deadline2)) {
StringBuilder sb = new StringBuilder(String.format("Call timeout set to '%d' ns, due to context deadline.", Long.valueOf(Math.max(0L, deadline.timeRemaining(TimeUnit.NANOSECONDS)))));
if (deadline3 == null) {
sb.append(" Explicit call timeout was not set.");
} else {
sb.append(String.format(" Explicit call timeout was '%d' ns.", Long.valueOf(deadline3.timeRemaining(TimeUnit.NANOSECONDS))));
}
logger.fine(sb.toString());
}
}
/* JADX INFO: Access modifiers changed from: private */
public void removeContextListenerAndCancelDeadlineFuture() {
this.context.removeListener(this.cancellationListener);
ScheduledFuture<?> scheduledFuture = this.deadlineCancellationFuture;
if (scheduledFuture != null) {
scheduledFuture.cancel(false);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public class DeadlineTimer implements Runnable {
private final long remainingNanos;
final ClientCallImpl this$0;
DeadlineTimer(ClientCallImpl clientCallImpl, long j) {
this.this$0 = clientCallImpl;
this.remainingNanos = j;
}
@Override // java.lang.Runnable
public void run() {
InsightBuilder insightBuilder = new InsightBuilder();
this.this$0.stream.appendTimeoutInsight(insightBuilder);
long abs = Math.abs(this.remainingNanos) / TimeUnit.SECONDS.toNanos(1L);
long abs2 = Math.abs(this.remainingNanos);
long nanos = TimeUnit.SECONDS.toNanos(1L);
StringBuilder sb = new StringBuilder("deadline exceeded after ");
if (this.remainingNanos < 0) {
sb.append('-');
}
sb.append(abs);
sb.append(String.format(Locale.US, ".%09d", Long.valueOf(abs2 % nanos)));
sb.append("s. ");
sb.append(insightBuilder);
this.this$0.stream.cancel(Status.DEADLINE_EXCEEDED.augmentDescription(sb.toString()));
}
}
private ScheduledFuture<?> startDeadlineTimer(Deadline deadline) {
long timeRemaining = deadline.timeRemaining(TimeUnit.NANOSECONDS);
return this.deadlineCancellationExecutor.schedule(new LogExceptionRunnable(new DeadlineTimer(this, timeRemaining)), timeRemaining, TimeUnit.NANOSECONDS);
}
/* JADX INFO: Access modifiers changed from: private */
public Deadline effectiveDeadline() {
return min(this.callOptions.getDeadline(), this.context.getDeadline());
}
private static Deadline min(Deadline deadline, Deadline deadline2) {
return deadline == null ? deadline2 : deadline2 == null ? deadline : deadline.minimum(deadline2);
}
@Override // io.grpc.ClientCall
public final void request(int i) {
C13115fRJ.g();
try {
boolean z = true;
Preconditions.checkState(this.stream != null, "Not started");
if (i < 0) {
z = false;
}
Preconditions.checkArgument(z, "Number requested must be non-negative");
this.stream.request(i);
} finally {
C13115fRJ.i();
}
}
@Override // io.grpc.ClientCall
public final void cancel(String str, Throwable th) {
C13115fRJ.g();
try {
cancelInternal(str, th);
} finally {
C13115fRJ.i();
}
}
private void cancelInternal(String str, Throwable th) {
Status withDescription;
if (str == null && th == null) {
th = new CancellationException("Cancelled without a message or cause");
log.log(Level.WARNING, "Cancelling without a message or cause is suboptimal", th);
}
if (this.cancelCalled) {
return;
}
this.cancelCalled = true;
try {
if (this.stream != null) {
Status status = Status.CANCELLED;
if (str != null) {
withDescription = status.withDescription(str);
} else {
withDescription = status.withDescription("Call cancelled without message");
}
if (th != null) {
withDescription = withDescription.withCause(th);
}
this.stream.cancel(withDescription);
}
} finally {
removeContextListenerAndCancelDeadlineFuture();
}
}
@Override // io.grpc.ClientCall
public final void halfClose() {
C13115fRJ.g();
try {
halfCloseInternal();
} finally {
C13115fRJ.i();
}
}
private void halfCloseInternal() {
Preconditions.checkState(this.stream != null, "Not started");
Preconditions.checkState(!this.cancelCalled, "call was cancelled");
Preconditions.checkState(!this.halfCloseCalled, "call already half-closed");
this.halfCloseCalled = true;
this.stream.halfClose();
}
@Override // io.grpc.ClientCall
public final void sendMessage(ReqT reqt) {
C13115fRJ.g();
try {
sendMessageInternal(reqt);
} finally {
C13115fRJ.i();
}
}
private void sendMessageInternal(ReqT reqt) {
Preconditions.checkState(this.stream != null, "Not started");
Preconditions.checkState(!this.cancelCalled, "call was cancelled");
Preconditions.checkState(!this.halfCloseCalled, "call was half-closed");
try {
ClientStream clientStream = this.stream;
if (clientStream instanceof RetriableStream) {
((RetriableStream) clientStream).sendMessage(reqt);
} else {
clientStream.writeMessage(this.method.streamRequest(reqt));
}
if (this.unaryRequest) {
return;
}
this.stream.flush();
} catch (Error e) {
this.stream.cancel(Status.CANCELLED.withDescription("Client sendMessage() failed with Error"));
throw e;
} catch (RuntimeException e2) {
this.stream.cancel(Status.CANCELLED.withCause(e2).withDescription("Failed to stream message"));
}
}
@Override // io.grpc.ClientCall
public final void setMessageCompression(boolean z) {
Preconditions.checkState(this.stream != null, "Not started");
this.stream.setMessageCompression(z);
}
@Override // io.grpc.ClientCall
public final boolean isReady() {
if (this.halfCloseCalled) {
return false;
}
return this.stream.isReady();
}
@Override // io.grpc.ClientCall
public final Attributes getAttributes() {
ClientStream clientStream = this.stream;
if (clientStream != null) {
return clientStream.getAttributes();
}
return Attributes.EMPTY;
}
/* JADX INFO: Access modifiers changed from: private */
public void closeObserver(ClientCall.Listener<RespT> listener, Status status, Metadata metadata) {
listener.onClose(status, metadata);
}
public final String toString() {
return MoreObjects.toStringHelper(this).add("method", this.method).toString();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public class ClientStreamListenerImpl implements ClientStreamListener {
private Status exceptionStatus;
private final ClientCall.Listener<RespT> observer;
final ClientCallImpl this$0;
public ClientStreamListenerImpl(ClientCallImpl clientCallImpl, ClientCall.Listener<RespT> listener) {
this.this$0 = clientCallImpl;
this.observer = (ClientCall.Listener) Preconditions.checkNotNull(listener, "observer");
}
/* JADX INFO: Access modifiers changed from: private */
public void exceptionThrown(Status status) {
this.exceptionStatus = status;
this.this$0.stream.cancel(status);
}
@Override // io.grpc.internal.ClientStreamListener
public void headersRead(Metadata metadata) {
fRN unused = this.this$0.tag;
C13115fRJ.g();
try {
this.this$0.callExecutor.execute(new ContextRunnable(this, C13115fRJ.h(), metadata) { // from class: io.grpc.internal.ClientCallImpl.ClientStreamListenerImpl.1HeadersRead
final ClientStreamListenerImpl this$1;
final Metadata val$headers;
final C13116fRL val$link;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.this$0.context);
this.this$1 = this;
this.val$link = r2;
this.val$headers = metadata;
}
@Override // io.grpc.internal.ContextRunnable
public final void runInContext() {
fRN unused2 = this.this$1.this$0.tag;
C13115fRJ.g();
C13115fRJ.e();
try {
runInternal();
} finally {
fRN unused3 = this.this$1.this$0.tag;
C13115fRJ.i();
}
}
private void runInternal() {
if (this.this$1.exceptionStatus != null) {
return;
}
try {
this.this$1.observer.onHeaders(this.val$headers);
} catch (Throwable th) {
this.this$1.exceptionThrown(Status.CANCELLED.withCause(th).withDescription("Failed to read headers"));
}
}
});
} finally {
fRN unused2 = this.this$0.tag;
C13115fRJ.i();
}
}
@Override // io.grpc.internal.StreamListener
public void messagesAvailable(StreamListener.MessageProducer messageProducer) {
fRN unused = this.this$0.tag;
C13115fRJ.g();
try {
this.this$0.callExecutor.execute(new ContextRunnable(this, C13115fRJ.h(), messageProducer) { // from class: io.grpc.internal.ClientCallImpl.ClientStreamListenerImpl.1MessagesAvailable
final ClientStreamListenerImpl this$1;
final C13116fRL val$link;
final StreamListener.MessageProducer val$producer;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.this$0.context);
this.this$1 = this;
this.val$link = r2;
this.val$producer = messageProducer;
}
@Override // io.grpc.internal.ContextRunnable
public final void runInContext() {
fRN unused2 = this.this$1.this$0.tag;
C13115fRJ.g();
C13115fRJ.e();
try {
runInternal();
} finally {
fRN unused3 = this.this$1.this$0.tag;
C13115fRJ.i();
}
}
private void runInternal() {
if (this.this$1.exceptionStatus != null) {
GrpcUtil.closeQuietly(this.val$producer);
return;
}
while (true) {
try {
InputStream next = this.val$producer.next();
if (next == null) {
return;
}
try {
this.this$1.observer.onMessage(this.this$1.this$0.method.parseResponse(next));
next.close();
} catch (Throwable th) {
GrpcUtil.closeQuietly(next);
throw th;
}
} catch (Throwable th2) {
GrpcUtil.closeQuietly(this.val$producer);
this.this$1.exceptionThrown(Status.CANCELLED.withCause(th2).withDescription("Failed to read message."));
return;
}
}
}
});
} finally {
fRN unused2 = this.this$0.tag;
C13115fRJ.i();
}
}
@Override // io.grpc.internal.ClientStreamListener
public void closed(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata metadata) {
fRN unused = this.this$0.tag;
C13115fRJ.g();
try {
closedInternal(status, rpcProgress, metadata);
} finally {
fRN unused2 = this.this$0.tag;
C13115fRJ.i();
}
}
private void closedInternal(Status status, ClientStreamListener.RpcProgress rpcProgress, Metadata metadata) {
Deadline effectiveDeadline = this.this$0.effectiveDeadline();
if (status.getCode() == Status.Code.CANCELLED && effectiveDeadline != null && effectiveDeadline.isExpired()) {
InsightBuilder insightBuilder = new InsightBuilder();
this.this$0.stream.appendTimeoutInsight(insightBuilder);
status = Status.DEADLINE_EXCEEDED.augmentDescription("ClientCall was cancelled at or after deadline. ".concat(String.valueOf(insightBuilder)));
metadata = new Metadata();
}
this.this$0.callExecutor.execute(new ContextRunnable(this, C13115fRJ.h(), status, metadata) { // from class: io.grpc.internal.ClientCallImpl.ClientStreamListenerImpl.1StreamClosed
final ClientStreamListenerImpl this$1;
final C13116fRL val$link;
final Status val$savedStatus;
final Metadata val$savedTrailers;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.this$0.context);
this.this$1 = this;
this.val$link = r2;
this.val$savedStatus = status;
this.val$savedTrailers = metadata;
}
@Override // io.grpc.internal.ContextRunnable
public final void runInContext() {
fRN unused = this.this$1.this$0.tag;
C13115fRJ.g();
C13115fRJ.e();
try {
runInternal();
} finally {
fRN unused2 = this.this$1.this$0.tag;
C13115fRJ.i();
}
}
private void runInternal() {
Status status2 = this.val$savedStatus;
Metadata metadata2 = this.val$savedTrailers;
if (this.this$1.exceptionStatus != null) {
status2 = this.this$1.exceptionStatus;
metadata2 = new Metadata();
}
this.this$1.this$0.cancelListenersShouldBeRemoved = true;
try {
this.this$1.this$0.closeObserver(this.this$1.observer, status2, metadata2);
} finally {
this.this$1.this$0.removeContextListenerAndCancelDeadlineFuture();
this.this$1.this$0.channelCallsTracer.reportCallEnded(status2.isOk());
}
}
});
}
@Override // io.grpc.internal.StreamListener
public void onReady() {
if (this.this$0.method.getType().clientSendsOneMessage()) {
return;
}
fRN unused = this.this$0.tag;
C13115fRJ.g();
try {
this.this$0.callExecutor.execute(new ContextRunnable(this, C13115fRJ.h()) { // from class: io.grpc.internal.ClientCallImpl.ClientStreamListenerImpl.1StreamOnReady
final ClientStreamListenerImpl this$1;
final C13116fRL val$link;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(this.this$0.context);
this.this$1 = this;
this.val$link = r2;
}
@Override // io.grpc.internal.ContextRunnable
public final void runInContext() {
fRN unused2 = this.this$1.this$0.tag;
C13115fRJ.g();
C13115fRJ.e();
try {
runInternal();
} finally {
fRN unused3 = this.this$1.this$0.tag;
C13115fRJ.i();
}
}
private void runInternal() {
if (this.this$1.exceptionStatus != null) {
return;
}
try {
this.this$1.observer.onReady();
} catch (Throwable th) {
this.this$1.exceptionThrown(Status.CANCELLED.withCause(th).withDescription("Failed to call onReady."));
}
}
});
} finally {
fRN unused2 = this.this$0.tag;
C13115fRJ.i();
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public final ClientCallImpl<ReqT, RespT> setFullStreamDecompression(boolean z) {
this.fullStreamDecompression = z;
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final ClientCallImpl<ReqT, RespT> setDecompressorRegistry(DecompressorRegistry decompressorRegistry) {
this.decompressorRegistry = decompressorRegistry;
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final ClientCallImpl<ReqT, RespT> setCompressorRegistry(CompressorRegistry compressorRegistry) {
this.compressorRegistry = compressorRegistry;
return this;
}
}