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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRPCPlugin(RPCPlugin plugin) Adds a new plugin to manipulate per-call metadata.org.apache.avro.ProtocolgetLocal()Return the local protocol.static org.apache.avro.ProtocolReturn the remote protocol.abstract ObjectreadRequest(org.apache.avro.Schema actual, org.apache.avro.Schema expected, org.apache.avro.io.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 ObjectComputes the response for a message.abstract voidwriteError(org.apache.avro.Schema schema, Object error, org.apache.avro.io.Encoder out) Writes an error message.abstract voidwriteResponse(org.apache.avro.Schema schema, Object response, org.apache.avro.io.Encoder out) Writes a response message.
-
Field Details
-
rpcMetaPlugins
-
-
Constructor Details
-
Responder
protected Responder(org.apache.avro.Protocol local)
-
-
Method Details
-
getRemote
public static org.apache.avro.Protocol getRemote()Return the remote protocol. Accesses aThreadLocalthat's set around calls torespond(Protocol.Message, Object). -
getLocal
public org.apache.avro.Protocol 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
public abstract Object respond(org.apache.avro.Protocol.Message message, Object request) throws Exception Computes the response for a message.- Throws:
Exception
-
readRequest
public abstract Object readRequest(org.apache.avro.Schema actual, org.apache.avro.Schema expected, org.apache.avro.io.Decoder in) throws IOException Reads a request message.- Throws:
IOException
-
writeResponse
public abstract void writeResponse(org.apache.avro.Schema schema, Object response, org.apache.avro.io.Encoder out) throws IOException Writes a response message.- Throws:
IOException
-
writeError
public abstract void writeError(org.apache.avro.Schema schema, Object error, org.apache.avro.io.Encoder out) throws IOException Writes an error message.- Throws:
IOException
-