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 ofClientStream
that 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 Status
error
private ClientStreamListener.RpcProgress
rpcProgress
private boolean
started
private ClientStreamTracer[]
tracers
-
Fields inherited from class io.grpc.internal.NoopClientStream
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description FailingClientStream(Status error, ClientStreamTracer[] tracers)
Creates aFailingClientStream
that would fail with the given error.FailingClientStream(Status error, ClientStreamListener.RpcProgress rpcProgress, ClientStreamTracer[] tracers)
Creates aFailingClientStream
that would fail with the given error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendTimeoutInsight(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) Status
getError()
void
start(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 aFailingClientStream
that would fail with the given error.
-
FailingClientStream
public FailingClientStream(Status error, ClientStreamListener.RpcProgress rpcProgress, ClientStreamTracer[] tracers)
Creates aFailingClientStream
that would fail with the given error.
-
-
Method Detail
-
start
public void start(ClientStreamListener listener)
Description copied from interface:ClientStream
Starts 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:
start
in interfaceClientStream
- Overrides:
start
in classNoopClientStream
- Parameters:
listener
- non-null
listener of stream events
-
getError
Status getError()
-
appendTimeoutInsight
public void appendTimeoutInsight(InsightBuilder insight)
Description copied from interface:ClientStream
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.- Specified by:
appendTimeoutInsight
in interfaceClientStream
- Overrides:
appendTimeoutInsight
in classNoopClientStream
-
-