org.apache.avro.ipc
Class RPCContext

java.lang.Object
  extended by org.apache.avro.ipc.RPCContext

public class RPCContext
extends Object

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
protected  Exception error
           
protected  Map<CharSequence,ByteBuffer> requestCallMeta
           
protected  Map<CharSequence,ByteBuffer> requestHandshakeMeta
           
protected  Object response
           
protected  Map<CharSequence,ByteBuffer> responseCallMeta
           
protected  Map<CharSequence,ByteBuffer> responseHandshakeMeta
           
 
Constructor Summary
RPCContext()
           
 
Method Summary
 Exception error()
          The exception generated at the server, or null if no such exception has occured
 Protocol.Message getMessage()
          Returns the Protocol.Message corresponding to this RPC
 List<ByteBuffer> getRequestPayload()
          Returns the serialized payload of the request in this RPC.
 List<ByteBuffer> getResponsePayload()
          Returns the serialized payload of the response in this RPC.
 boolean isError()
          Indicates whether an exception was generated at the server
 Map<CharSequence,ByteBuffer> requestCallMeta()
          This is an access method for the per-call state provided by the client to the server.
 Map<CharSequence,ByteBuffer> requestHandshakeMeta()
          This is an access method for the handshake state provided by the client to the server.
 Object response()
          The response object generated at the server, if it exists.
 Map<CharSequence,ByteBuffer> responseCallMeta()
          This is an access method for the per-call state provided by the server back to the client.
 Map<CharSequence,ByteBuffer> responseHandshakeMeta()
          This is an access method for the handshake state provided by the server back to the client
 void setMessage(Protocol.Message message)
          Sets the Protocol.Message corresponding to this RPC
 void 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestHandshakeMeta

protected Map<CharSequence,ByteBuffer> requestHandshakeMeta

responseHandshakeMeta

protected Map<CharSequence,ByteBuffer> responseHandshakeMeta

requestCallMeta

protected Map<CharSequence,ByteBuffer> requestCallMeta

responseCallMeta

protected Map<CharSequence,ByteBuffer> responseCallMeta

response

protected Object response

error

protected Exception error
Constructor Detail

RPCContext

public RPCContext()
Method Detail

requestHandshakeMeta

public Map<CharSequence,ByteBuffer> 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

public Map<CharSequence,ByteBuffer> 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

public Map<CharSequence,ByteBuffer> 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

public Map<CharSequence,ByteBuffer> 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

public Object 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

public Exception error()
The exception generated at the server, or null if no such exception has occured

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

public void setMessage(Protocol.Message message)
Sets the Protocol.Message corresponding to this RPC


getMessage

public Protocol.Message getMessage()
Returns the Protocol.Message corresponding to this RPC

Returns:
this RPC's Protocol.Message

setRequestPayload

public void setRequestPayload(List<ByteBuffer> payload)
Sets the serialized payload of the request in this RPC. Will not include handshake or meta-data.


getRequestPayload

public List<ByteBuffer> 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

public List<ByteBuffer> 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

public void setResponsePayload(List<ByteBuffer> payload)
Sets the serialized payload of the response in this RPC. Will not include handshake or meta-data.



Copyright © 2010 The Apache Software Foundation