Package org.apache.avro.ipc
Class Responder
java.lang.Object
org.apache.avro.ipc.Responder
- Direct Known Subclasses:
GenericResponder
Base class for the server side of a protocol interaction.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRPCPlugin
(RPCPlugin plugin) Adds a new plugin to manipulate per-call metadata.getLocal()
Return the local protocol.static Protocol
Return the remote protocol.abstract Object
readRequest
(Schema actual, Schema expected, Decoder in) Reads a request message.respond
(List<ByteBuffer> buffers) Called by a server to deserialize a request, compute and serialize a response or error.respond
(List<ByteBuffer> buffers, Transceiver connection) Called by a server to deserialize a request, compute and serialize a response or error.abstract Object
respond
(Protocol.Message message, Object request) Computes the response for a message.abstract void
writeError
(Schema schema, Object error, Encoder out) Writes an error message.abstract void
writeResponse
(Schema schema, Object response, Encoder out) Writes a response message.
-
Field Details
-
rpcMetaPlugins
-
-
Constructor Details
-
Responder
-
-
Method Details
-
getRemote
Return the remote protocol. Accesses aThreadLocal
that's set around calls torespond(Protocol.Message, Object)
. -
getLocal
Return the local protocol. -
addRPCPlugin
Adds a new plugin to manipulate per-call metadata. Plugins are executed in the order that they are added.- Parameters:
plugin
- a plugin that will manipulate RPC metadata
-
respond
Called by a server to deserialize a request, compute and serialize a response or error.- Throws:
IOException
-
respond
public List<ByteBuffer> respond(List<ByteBuffer> buffers, Transceiver connection) throws IOException Called by a server to deserialize a request, compute and serialize a response or error. Transceiver is used by connection-based servers to track handshake status of connection.- Throws:
IOException
-
respond
Computes the response for a message.- Throws:
Exception
-
readRequest
Reads a request message.- Throws:
IOException
-
writeResponse
Writes a response message.- Throws:
IOException
-
writeError
Writes an error message.- Throws:
IOException
-