public final class RpcUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RpcUtil.AlreadyCalledException
Exception thrown when a one-time callback is called more than once.
|
Modifier and Type | Method and Description |
---|---|
static |
generalizeCallback(RpcCallback
Take an
RpcCallback accepting a specific message type and convert it to an RpcCallback . |
static |
newOneTimeCallback(RpcCallback
Creates a callback which can only be called once.
|
static |
specializeCallback(RpcCallback<Message> originalCallback)
Take an
RpcCallback and convert it to an RpcCallback accepting a
specific message type. |
public staticMessage> RpcCallback specializeCallback(RpcCallback<Message> originalCallback)
RpcCallback
and convert it to an RpcCallback
accepting a
specific message type. This is always type-safe (parameter type contravariance).public staticMessage> RpcCallback<Message> generalizeCallback(RpcCallback originalCallback, java.lang.Class originalClass, Type defaultInstance)
RpcCallback
accepting a specific message type and convert it to an RpcCallback
. The generalized callback will accept any message object which has the
same descriptor, and will convert it to the correct class before calling the original callback.
However, if the generalized callback is given a message with a different descriptor, an
exception will be thrown.public staticRpcCallback newOneTimeCallback(RpcCallback originalCallback)