Top Description Methods
io.grpc

public Interface ServerCallHandler<RequestT, ResponseT>

Known Direct Implementers
io.grpc.ServerInterceptors.InterceptCallHandler
Annotations
@ThreadSafe
Imports
javax.annotation.concurrent.ThreadSafe

Interface to initiate processing of incoming remote calls. Advanced applications and generated code will implement this interface to allows Servers to invoke service methods.

Method Summary

Modifier and TypeMethod and Description
public ServerCall.Listener<RequestT>

Returns:

listener for processing incoming request messages for call
startCall
(ServerCall<RequestT, ResponseT>
object for responding to the remote client.
call
,
Metadata
request headers received from the client but open to modification by an owner
headers
)

Starts asynchronous processing of an incoming call.

Method Detail

startCallback to summary
public ServerCall.Listener<RequestT> startCall(ServerCall<RequestT, ResponseT> call, Metadata headers)

Starts asynchronous processing of an incoming call.

Callers of this method transfer their ownership of the non-thread-safe ServerCall and Metadata arguments to the ServerCallHandler implementation for processing. Ownership means that the implementation may invoke methods on call and headers while startCall runs and at any time after it returns normally. On the other hand, if startCall throws, ownership of call and headers 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, if startCall throws an exception, the caller must handle it by closing call with an error. Since call can only be closed once, an implementation can report errors either to ServerCall#close 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.

Parameters
call:ServerCall<RequestT, ResponseT>

object for responding to the remote client.

headers:Metadata

request headers received from the client but open to modification by an owner

Returns:ServerCall.Listener<RequestT>

listener for processing incoming request messages for call