public abstract class Responder extends Object
Modifier and Type | Field and Description |
---|---|
protected List<RPCPlugin> |
rpcMetaPlugins |
Modifier | Constructor and Description |
---|---|
protected |
Responder(Protocol local) |
Modifier and Type | Method and Description |
---|---|
void |
addRPCPlugin(RPCPlugin plugin)
Adds a new plugin to manipulate per-call metadata.
|
Protocol |
getLocal()
Return the local protocol.
|
static Protocol |
getRemote()
Return the remote protocol.
|
abstract Object |
readRequest(Schema actual,
Schema expected,
Decoder in)
Reads a request message.
|
List<ByteBuffer> |
respond(List<ByteBuffer> buffers)
Called by a server to deserialize a request, compute and serialize
a response or error.
|
List<ByteBuffer> |
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.
|
protected Responder(Protocol local)
public static Protocol getRemote()
ThreadLocal
that's set
around calls to respond(Protocol.Message, Object)
.public Protocol getLocal()
public void addRPCPlugin(RPCPlugin plugin)
plugin
- a plugin that will manipulate RPC metadatapublic List<ByteBuffer> respond(List<ByteBuffer> buffers) throws IOException
IOException
public List<ByteBuffer> respond(List<ByteBuffer> buffers, Transceiver connection) throws IOException
IOException
public abstract Object respond(Protocol.Message message, Object request) throws Exception
Exception
public abstract Object readRequest(Schema actual, Schema expected, Decoder in) throws IOException
IOException
public abstract void writeResponse(Schema schema, Object response, Encoder out) throws IOException
IOException
public abstract void writeError(Schema schema, Object error, Encoder out) throws IOException
IOException
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.