65 lines
2.4 KiB
Java
65 lines
2.4 KiB
Java
package io.grpc.internal;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
import com.google.common.util.concurrent.SettableFuture;
|
|
import io.grpc.CallOptions;
|
|
import io.grpc.ClientStreamTracer;
|
|
import io.grpc.InternalChannelz;
|
|
import io.grpc.InternalLogId;
|
|
import io.grpc.Metadata;
|
|
import io.grpc.MethodDescriptor;
|
|
import io.grpc.Status;
|
|
import io.grpc.internal.ClientStreamListener;
|
|
import io.grpc.internal.ClientTransport;
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public class FailingClientTransport implements ClientTransport {
|
|
final Status error;
|
|
private final ClientStreamListener.RpcProgress rpcProgress;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public FailingClientTransport(Status status, ClientStreamListener.RpcProgress rpcProgress) {
|
|
Preconditions.checkArgument(!status.isOk(), "error must not be OK");
|
|
this.error = status;
|
|
this.rpcProgress = rpcProgress;
|
|
}
|
|
|
|
@Override // io.grpc.internal.ClientTransport
|
|
public ClientStream newStream(MethodDescriptor<?, ?> methodDescriptor, Metadata metadata, CallOptions callOptions, ClientStreamTracer[] clientStreamTracerArr) {
|
|
return new FailingClientStream(this.error, this.rpcProgress, clientStreamTracerArr);
|
|
}
|
|
|
|
@Override // io.grpc.internal.ClientTransport
|
|
public void ping(ClientTransport.PingCallback pingCallback, Executor executor) {
|
|
executor.execute(new Runnable(this, pingCallback) { // from class: io.grpc.internal.FailingClientTransport.1
|
|
final FailingClientTransport this$0;
|
|
final ClientTransport.PingCallback val$callback;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$callback = pingCallback;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
this.val$callback.onFailure(this.this$0.error.asException());
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // io.grpc.InternalInstrumented
|
|
public ListenableFuture<InternalChannelz.SocketStats> getStats() {
|
|
SettableFuture create = SettableFuture.create();
|
|
create.set(null);
|
|
return create;
|
|
}
|
|
|
|
@Override // io.grpc.InternalWithLogId
|
|
public InternalLogId getLogId() {
|
|
throw new UnsupportedOperationException("Not a real transport");
|
|
}
|
|
}
|