@ThreadSafe public interface ServerCallHandler<RequestT,ResponseT>
Servers to invoke service methods.
|Modifier and Type||Method and Description|
Starts asynchronous processing of an incoming call.
ServerCall.Listener<RequestT> startCall(ServerCall<RequestT,ResponseT> call, Metadata headers)
Callers of this method transfer their ownership of the non-thread-safe
Metadata arguments to the
ServerCallHandler implementation for processing.
Ownership means that the implementation may invoke methods on
startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata) runs and at any time after it returns normally. On the other hand, if
startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata) throws, ownership of
headers reverts to the caller
and the implementation loses the right to call methods on these objects (from some other
Ownership also includes the responsibility to eventually close
call. In particular,
startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata) throws an exception, the caller must handle it by closing
with an error. Since
call can only be closed once, an implementation can report errors
ServerCall.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 with
call to be delivered there.
call- object for responding to the remote client.
headers- request headers received from the client but open to modification by an owner