Package org.apache.avro.ipc
Class RPCContext
java.lang.Object
org.apache.avro.ipc.RPCContext
This class represents the context of an RPC call or RPC handshake. Designed
to provide information to RPC plugin writers, this class encapsulates
information about the rpc exchange, including handshake and call metadata.
Note: this data includes full copies of the RPC payload, so plugins which
store RPCContexts beyond the life of each call should be conscious of memory
use.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Exception
protected Map
<String, ByteBuffer> protected Object
protected Map
<String, ByteBuffer> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionerror()
The exception generated at the server, or null if no such exception has occurredGet the handshake request of this RPC.Get the handshake response of this RPC.Returns theProtocol.Message
corresponding to this RPCReturns the serialized payload of the request in this RPC.Returns the serialized payload of the response in this RPC.boolean
isError()
Indicates whether an exception was generated at the serverThis is an access method for the per-call state provided by the client to the server.This is an access method for the handshake state provided by the client to the server.response()
The response object generated at the server, if it exists.This is an access method for the per-call state provided by the server back to the client.This is an access method for the handshake state provided by the server back to the clientvoid
setHandshakeRequest
(HandshakeRequest handshakeRequest) Set the handshake request of this RPC.void
setHandshakeResponse
(HandshakeResponse handshakeResponse) Set the handshake response of this RPC.void
setMessage
(Protocol.Message message) Sets theProtocol.Message
corresponding to this RPCvoid
setRequestPayload
(List<ByteBuffer> payload) Sets the serialized payload of the request in this RPC.void
setResponsePayload
(List<ByteBuffer> payload) Sets the serialized payload of the response in this RPC.
-
Field Details
-
requestCallMeta
-
responseCallMeta
-
response
-
error
-
-
Constructor Details
-
RPCContext
public RPCContext()
-
-
Method Details
-
setHandshakeRequest
Set the handshake request of this RPC. -
getHandshakeRequest
Get the handshake request of this RPC. -
setHandshakeResponse
Set the handshake response of this RPC. -
getHandshakeResponse
Get the handshake response of this RPC. -
requestHandshakeMeta
This is an access method for the handshake state provided by the client to the server.- Returns:
- a map representing handshake state from the client to the server
-
responseHandshakeMeta
This is an access method for the handshake state provided by the server back to the client- Returns:
- a map representing handshake state from the server to the client
-
requestCallMeta
This is an access method for the per-call state provided by the client to the server.- Returns:
- a map representing per-call state from the client to the server
-
responseCallMeta
This is an access method for the per-call state provided by the server back to the client.- Returns:
- a map representing per-call state from the server to the client
-
response
The response object generated at the server, if it exists. If an exception was generated, this will be null.- Returns:
- the response created by this RPC, no null if an exception was generated
-
error
The exception generated at the server, or null if no such exception has occurred- Returns:
- the exception generated at the server, or null if no such exception
-
isError
public boolean isError()Indicates whether an exception was generated at the server- Returns:
- true is an exception was generated at the server, or false if not
-
setMessage
Sets theProtocol.Message
corresponding to this RPC -
getMessage
Returns theProtocol.Message
corresponding to this RPC- Returns:
- this RPC's
Protocol.Message
-
setRequestPayload
Sets the serialized payload of the request in this RPC. Will not include handshake or meta-data. -
getRequestPayload
Returns the serialized payload of the request in this RPC. Will only be generated from a Requestor and will not include handshake or meta-data. If the request payload has not been set yet, returns null.- Returns:
- this RPC's request payload.
-
getResponsePayload
Returns the serialized payload of the response in this RPC. Will only be generated from a Responder and will not include handshake or meta-data. If the response payload has not been set yet, returns null.- Returns:
- this RPC's response payload.
-
setResponsePayload
Sets the serialized payload of the response in this RPC. Will not include handshake or meta-data.
-