Class ServerCalls.StreamingServerCallHandler<ReqT,RespT>
- java.lang.Object
-
- io.grpc.stub.ServerCalls.StreamingServerCallHandler<ReqT,RespT>
-
- All Implemented Interfaces:
ServerCallHandler<ReqT,RespT>
- Enclosing class:
- ServerCalls
private static final class ServerCalls.StreamingServerCallHandler<ReqT,RespT> extends java.lang.Object implements ServerCallHandler<ReqT,RespT>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ServerCalls.StreamingServerCallHandler.StreamingServerCallListener
-
Field Summary
Fields Modifier and Type Field Description private boolean
bidi
private ServerCalls.StreamingRequestMethod<ReqT,RespT>
method
-
Constructor Summary
Constructors Constructor Description StreamingServerCallHandler(ServerCalls.StreamingRequestMethod<ReqT,RespT> method, boolean bidi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerCall.Listener<ReqT>
startCall(ServerCall<ReqT,RespT> call, Metadata headers)
Starts asynchronous processing of an incoming call.
-
-
-
Field Detail
-
method
private final ServerCalls.StreamingRequestMethod<ReqT,RespT> method
-
bidi
private final boolean bidi
-
-
Constructor Detail
-
StreamingServerCallHandler
StreamingServerCallHandler(ServerCalls.StreamingRequestMethod<ReqT,RespT> method, boolean bidi)
-
-
Method Detail
-
startCall
public ServerCall.Listener<ReqT> startCall(ServerCall<ReqT,RespT> call, Metadata headers)
Description copied from interface:ServerCallHandler
Starts asynchronous processing of an incoming call.Callers of this method transfer their ownership of the non-thread-safe
ServerCall
andMetadata
arguments to theServerCallHandler
implementation for processing. Ownership means that the implementation may invoke methods oncall
andheaders
whileServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
runs and at any time after it returns normally. On the other hand, ifServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
throws, ownership ofcall
andheaders
reverts to the caller and the implementation loses the right to call methods on these objects (from some other thread, say).Ownership also includes the responsibility to eventually close
call
. In particular, ifServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
throws an exception, the caller must handle it by closingcall
with an error. Sincecall
can only be closed once, an implementation can report errors either toServerCall.close(io.grpc.Status, io.grpc.Metadata)
for itself or by throwing an exception, but not both.Returns a non-
null
listener for the incoming call. Callers of this method must arrange for events associated withcall
to be delivered there.- Specified by:
startCall
in interfaceServerCallHandler<ReqT,RespT>
- Parameters:
call
- object for responding to the remote client.headers
- request headers received from the client but open to modification by an owner- Returns:
- listener for processing incoming request messages for
call
-
-