Package io.grpc.stub
Class ClientCalls.UnaryStreamToFuture<RespT>
- java.lang.Object
-
- io.grpc.ClientCall.Listener<T>
-
- io.grpc.stub.ClientCalls.StartableListener<RespT>
-
- io.grpc.stub.ClientCalls.UnaryStreamToFuture<RespT>
-
- Enclosing class:
- ClientCalls
private static final class ClientCalls.UnaryStreamToFuture<RespT> extends ClientCalls.StartableListener<RespT>
Completes aClientCalls.GrpcFuture
usingStreamObserver
events.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isValueReceived
private ClientCalls.GrpcFuture<RespT>
responseFuture
private RespT
value
-
Constructor Summary
Constructors Constructor Description UnaryStreamToFuture(ClientCalls.GrpcFuture<RespT> responseFuture)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onClose(Status status, Metadata trailers)
The ClientCall has been closed.void
onHeaders(Metadata headers)
The response headers have been received.void
onMessage(RespT value)
A response message has been received.(package private) void
onStart()
-
Methods inherited from class io.grpc.ClientCall.Listener
onReady
-
-
-
-
Field Detail
-
responseFuture
private final ClientCalls.GrpcFuture<RespT> responseFuture
-
value
private RespT value
-
isValueReceived
private boolean isValueReceived
-
-
Constructor Detail
-
UnaryStreamToFuture
UnaryStreamToFuture(ClientCalls.GrpcFuture<RespT> responseFuture)
-
-
Method Detail
-
onHeaders
public void onHeaders(Metadata headers)
Description copied from class:ClientCall.Listener
The response headers have been received. Headers always precede messages.Since
Metadata
is not thread-safe, the caller must not access (read or write)headers
after this point.- Overrides:
onHeaders
in classClientCall.Listener<RespT>
- Parameters:
headers
- containing metadata sent by the server at the start of the response.
-
onMessage
public void onMessage(RespT value)
Description copied from class:ClientCall.Listener
A response message has been received. May be called zero or more times depending on whether the call response is empty, a single message or a stream of messages.- Overrides:
onMessage
in classClientCall.Listener<RespT>
- Parameters:
value
- returned by the server
-
onClose
public void onClose(Status status, Metadata trailers)
Description copied from class:ClientCall.Listener
The ClientCall has been closed. Any additional calls to theClientCall
will not be processed by the server. No further receiving will occur and no further notifications will be made.Since
Metadata
is not thread-safe, the caller must not access (read or write)trailers
after this point.If
status
returns false forStatus.isOk()
, then the call failed. An additional block of trailer metadata may be received at the end of the call from the server. An emptyMetadata
object is passed if no trailers are received.This method should not throw. If this method throws, there is no way to be notified of the exception. Implementations should therefore be careful of exceptions which can accidentally leak resources.
- Overrides:
onClose
in classClientCall.Listener<RespT>
- Parameters:
status
- the result of the remote call.trailers
- metadata provided at call completion.
-
onStart
void onStart()
- Specified by:
onStart
in classClientCalls.StartableListener<RespT>
-
-