Package io.grpc.internal
Class FailingClientStream
- java.lang.Object
-
- io.grpc.internal.NoopClientStream
-
- io.grpc.internal.FailingClientStream
-
- All Implemented Interfaces:
ClientStream,Stream
public final class FailingClientStream extends NoopClientStream
An implementation ofClientStreamthat fails (by callingClientStreamListener.closed(io.grpc.Status, io.grpc.internal.ClientStreamListener.RpcProgress, io.grpc.Metadata)) when started, and silently does nothing for the other operations.
-
-
Field Summary
Fields Modifier and Type Field Description private Statuserrorprivate ClientStreamListener.RpcProgressrpcProgressprivate booleanstartedprivate ClientStreamTracer[]tracers-
Fields inherited from class io.grpc.internal.NoopClientStream
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description FailingClientStream(Status error, ClientStreamTracer[] tracers)Creates aFailingClientStreamthat would fail with the given error.FailingClientStream(Status error, ClientStreamListener.RpcProgress rpcProgress, ClientStreamTracer[] tracers)Creates aFailingClientStreamthat would fail with the given error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendTimeoutInsight(InsightBuilder insight)Append information that will be included in the locally generated DEADLINE_EXCEEDED errors to the givenInsightBuilder, in order to tell the user about the state of the stream so that they can better diagnose the cause of the error.(package private) StatusgetError()voidstart(ClientStreamListener listener)Starts stream.-
Methods inherited from class io.grpc.internal.NoopClientStream
cancel, flush, getAttributes, halfClose, isReady, optimizeForDirectExecutor, request, setAuthority, setCompressor, setDeadline, setDecompressorRegistry, setFullStreamDecompression, setMaxInboundMessageSize, setMaxOutboundMessageSize, setMessageCompression, writeMessage
-
-
-
-
Field Detail
-
started
private boolean started
-
error
private final Status error
-
rpcProgress
private final ClientStreamListener.RpcProgress rpcProgress
-
tracers
private final ClientStreamTracer[] tracers
-
-
Constructor Detail
-
FailingClientStream
public FailingClientStream(Status error, ClientStreamTracer[] tracers)
Creates aFailingClientStreamthat would fail with the given error.
-
FailingClientStream
public FailingClientStream(Status error, ClientStreamListener.RpcProgress rpcProgress, ClientStreamTracer[] tracers)
Creates aFailingClientStreamthat would fail with the given error.
-
-
Method Detail
-
start
public void start(ClientStreamListener listener)
Description copied from interface:ClientStreamStarts stream. This method may only be called once. It is safe to do latent initialization of the stream up untilClientStream.start(io.grpc.internal.ClientStreamListener)is called.This method should not throw any exceptions.
- Specified by:
startin interfaceClientStream- Overrides:
startin classNoopClientStream- Parameters:
listener- non-nulllistener of stream events
-
getError
Status getError()
-
appendTimeoutInsight
public void appendTimeoutInsight(InsightBuilder insight)
Description copied from interface:ClientStreamAppend information that will be included in the locally generated DEADLINE_EXCEEDED errors to the givenInsightBuilder, in order to tell the user about the state of the stream so that they can better diagnose the cause of the error.- Specified by:
appendTimeoutInsightin interfaceClientStream- Overrides:
appendTimeoutInsightin classNoopClientStream
-
-