public abstract class ForwardingClientCall<ReqT,RespT> extends ClientCall<ReqT,RespT>
ClientCall
which forwards all of it's methods to another ClientCall
.Modifier and Type | Class and Description |
---|---|
static class |
ForwardingClientCall.SimpleForwardingClientCall<ReqT,RespT>
A simplified version of
ForwardingClientCall where subclasses can pass in a ClientCall as the delegate. |
ClientCall.Listener<T>
Constructor and Description |
---|
ForwardingClientCall() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Prevent any further processing for this ClientCall.
|
protected abstract ClientCall<ReqT,RespT> |
delegate()
Returns the delegated
ClientCall . |
void |
halfClose()
Close the call for request message sending.
|
boolean |
isReady()
If
true , indicates that the call is capable of sending additional messages
without requiring excessive buffering internally. |
void |
request(int numMessages)
Requests up to the given number of messages from the call to be delivered to
ClientCall.Listener.onMessage(Object) . |
void |
sendMessage(ReqT message)
Send a request message to the server.
|
void |
start(ClientCall.Listener<RespT> responseListener,
Metadata.Headers headers)
Start a call, using
responseListener for processing response messages. |
protected abstract ClientCall<ReqT,RespT> delegate()
ClientCall
.public void start(ClientCall.Listener<RespT> responseListener, Metadata.Headers headers)
ClientCall
responseListener
for processing response messages.start
in class ClientCall<ReqT,RespT>
responseListener
- receives response messagesheaders
- which can contain extra call metadata, e.g. authentication credentials.public void request(int numMessages)
ClientCall
ClientCall.Listener.onMessage(Object)
. No additional messages will be delivered.
Message delivery is guaranteed to be sequential in the order received. In addition, the listener methods will not be accessed concurrently. While it is not guaranteed that the same thread will always be used, it is guaranteed that only a single thread will access the listener at a time.
If it is desired to bypass inbound flow control, a very large number of messages can be
specified (e.g. Integer.MAX_VALUE
).
request
in class ClientCall<ReqT,RespT>
numMessages
- the requested number of messages to be delivered to the listener.public void cancel()
ClientCall
cancel()
ed or ClientCall.halfClose()
d.cancel
in class ClientCall<ReqT,RespT>
public void halfClose()
ClientCall
halfClose
in class ClientCall<ReqT,RespT>
public void sendMessage(ReqT message)
ClientCall
sendMessage
in class ClientCall<ReqT,RespT>
message
- message to be sent to the server.public boolean isReady()
ClientCall
true
, indicates that the call is capable of sending additional messages
without requiring excessive buffering internally. This event is
just a suggestion and the application is free to ignore it, however doing so may
result in excessive buffering within the call.
This implementation always returns true
.
isReady
in class ClientCall<ReqT,RespT>