Class FailingClientTransport
- java.lang.Object
-
- io.grpc.internal.FailingClientTransport
-
- All Implemented Interfaces:
ClientTransport
,InternalInstrumented<InternalChannelz.SocketStats>
,InternalWithLogId
class FailingClientTransport extends java.lang.Object implements ClientTransport
A client transport that creates streams that will immediately fail when started.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.grpc.internal.ClientTransport
ClientTransport.PingCallback
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Status
error
private ClientStreamListener.RpcProgress
rpcProgress
-
Constructor Summary
Constructors Constructor Description FailingClientTransport(Status error, ClientStreamListener.RpcProgress rpcProgress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InternalLogId
getLogId()
Returns an ID that is primarily used in debug logs.com.google.common.util.concurrent.ListenableFuture<InternalChannelz.SocketStats>
getStats()
Returns the stats object.ClientStream
newStream(MethodDescriptor<?,?> method, Metadata headers, CallOptions callOptions, ClientStreamTracer[] tracers)
Creates a new stream for sending messages to a remote end-point.void
ping(ClientTransport.PingCallback callback, java.util.concurrent.Executor executor)
Pings a remote endpoint.
-
-
-
Field Detail
-
error
final Status error
-
rpcProgress
private final ClientStreamListener.RpcProgress rpcProgress
-
-
Constructor Detail
-
FailingClientTransport
FailingClientTransport(Status error, ClientStreamListener.RpcProgress rpcProgress)
-
-
Method Detail
-
newStream
public ClientStream newStream(MethodDescriptor<?,?> method, Metadata headers, CallOptions callOptions, ClientStreamTracer[] tracers)
Description copied from interface:ClientTransport
Creates a new stream for sending messages to a remote end-point.This method returns immediately and does not wait for any validation of the request. If creation fails for any reason,
ClientStreamListener.closed(io.grpc.Status, io.grpc.internal.ClientStreamListener.RpcProgress, io.grpc.Metadata)
will be called to provide the error information. Any sent messages for this stream will be buffered until creation has completed (either successfully or unsuccessfully).This method is called under the
Context
of theClientCall
.- Specified by:
newStream
in interfaceClientTransport
- Parameters:
method
- the descriptor of the remote method to be called for this stream.headers
- to send at the beginning of the callcallOptions
- runtime options of the calltracers
- a non-empty array of tracers. The last element in it is reserved to be set by the load balancer's pick result and otherwise is a no-op tracer.- Returns:
- the newly created stream.
-
ping
public void ping(ClientTransport.PingCallback callback, java.util.concurrent.Executor executor)
Description copied from interface:ClientTransport
Pings a remote endpoint. When an acknowledgement is received, the given callback will be invoked using the given executor.Pings are not necessarily sent to the same endpoint, thus a successful ping only means at least one endpoint responded, but doesn't imply the availability of other endpoints (if there is any).
This is an optional method. Transports that do not have any mechanism by which to ping the remote endpoint may throw
UnsupportedOperationException
.- Specified by:
ping
in interfaceClientTransport
-
getStats
public com.google.common.util.concurrent.ListenableFuture<InternalChannelz.SocketStats> getStats()
Description copied from interface:InternalInstrumented
Returns the stats object.- Specified by:
getStats
in interfaceInternalInstrumented<InternalChannelz.SocketStats>
-
getLogId
public InternalLogId getLogId()
Description copied from interface:InternalWithLogId
Returns an ID that is primarily used in debug logs. It usually contains the class name and a numeric ID that is unique among the instances.The subclasses of this interface usually want to include the log ID in their
Object.toString()
results.- Specified by:
getLogId
in interfaceInternalWithLogId
-
-