com.flat502.rox.client
Class HttpRpcClient

java.lang.Object
  extended by com.flat502.rox.processing.HttpRpcProcessor
      extended by com.flat502.rox.client.HttpRpcClient
Direct Known Subclasses:
XmlRpcClient

public abstract class HttpRpcClient
extends HttpRpcProcessor

This is the client-side RPC interface.

This class supports both synchronous and asynchronous method calls. An instance is backed by at least two threads: a selecting thread and a worker thread. Both threads are daemon threads.

The selecting thread handles all low-level network I/O. As soon as this thread identifies a complete HTTP response the response is passed to the worker thread (or threads).

The number of worker threads may be adjusted dynamically using the inherited HttpRpcProcessor.addWorker() and HttpRpcProcessor.removeWorker() methods. Worker threads are responsible for callbacks when the asynchronous API is used.


Field Summary
 
Fields inherited from class com.flat502.rox.processing.HttpRpcProcessor
ALL_CIPHER_SUITES, ANON_CIPHER_SUITES
 
Constructor Summary
protected HttpRpcClient(java.net.URL url, ClientResourcePool pool)
          Initializes a new instance using the given URL.
protected HttpRpcClient(java.net.URL url, ClientResourcePool pool, SSLConfiguration sslCfg)
           
 
Method Summary
protected  void connect(java.nio.channels.SelectionKey key)
          Called when a requested connect operation on a SocketChannel is eligible for completion.
protected  void deregisterChannel(java.nio.channels.SelectableChannel channel)
           
 java.lang.Object execute(java.lang.String name, java.lang.Object[] params)
          Executes the named RPC method call synchronously, using the parameter list specified.
 void execute(java.lang.String name, java.lang.Object[] params, AsynchronousResponseHandler handler)
          Executes the named RPC method call asynchronously, using the parameter list specified.
 java.lang.Object execute(java.lang.String name, java.lang.Object[] params, java.lang.Class retClass)
          Executes the named RPC method call synchronously, using the parameter list specified.
 void execute(java.lang.String name, java.lang.Object[] params, java.lang.Class retClass, AsynchronousResponseHandler handler)
          Executes the named RPC method call asynchronously, using the parameter list specified.
 void execute(java.lang.String name, java.lang.Object[] params, java.lang.Class retClass, ResponseHandler handler)
          Deprecated. Use execute(String, Object[], Class, AsynchronousResponseHandler) instead.
 java.lang.Object execute(java.lang.String name, java.lang.Object[] params, MethodResponseUnmarshallerAid aid)
          Executes the named RPC method call synchronously, using the parameter list specified.
 void execute(java.lang.String name, java.lang.Object[] params, MethodResponseUnmarshallerAid aid, AsynchronousResponseHandler handler)
          Executes the named RPC method call asynchronously, using the parameter list specified.
 void execute(java.lang.String name, java.lang.Object[] params, MethodResponseUnmarshallerAid aid, ResponseHandler handler)
          Deprecated. Use execute(String, Object[], MethodResponseUnmarshallerAid, AsynchronousResponseHandler) instead.
 void execute(java.lang.String name, java.lang.Object[] params, ResponseHandler handler)
          Deprecated. Use execute(String, Object[], AsynchronousResponseHandler) instead.
protected abstract  MethodResponseUnmarshaller getMethodResponseUnmarshaller()
          Retrieves an MethodResponseUnmarshaller instance for unmarshalling incoming RpcResponses.
protected  HttpMessageBuffer getReadBuffer(java.net.Socket socket)
          Called when data is available on a socket.
protected  java.lang.String getUserAgent()
           
protected  java.nio.ByteBuffer getWriteBuffer(java.net.Socket socket)
          Called when a socket becomes available for writing.
protected  void handleMessageException(HttpMessageBuffer msg, java.lang.Exception e)
          Creates a new instance of HttpMessageException and enqueues it on the queue shared by worker threads.
protected  void handleProcessingException(java.net.Socket socket, java.lang.Exception e)
          An error handler invoked when an error occurs within the main processing loop.
protected  void handleSelectionKeyOperation(java.nio.channels.SelectionKey key)
          This implementation defers to the connect(SelectionKey) method if a connection is ready for completion.
protected  void handleSSLHandshakeFinished(java.net.Socket socket, javax.net.ssl.SSLEngine engine)
           
protected  void handleTimeout(java.net.Socket socket, java.lang.Exception cause)
           
protected  void initialize()
          This implementation defers to the parent implementation before marking this thread as a daemon thread and starting the thread.
protected  javax.net.ssl.SSLEngine initSocketSSLEngine(java.net.Socket socket)
           
protected  boolean isWriteQueued(java.net.Socket socket)
          Called to find out if data is queued to be written to a socket.
protected  HttpRequest newHttpRequest(RpcCall call)
           
protected abstract  RpcCall newRpcCall(java.lang.String name, java.lang.Object[] params)
           
protected  RpcResponseContext newRpcResponseContext(java.net.Socket socket, HttpResponseBuffer rsp)
           
protected  ResourcePool newWorkerPool()
          Factory method for new worker pools.
 java.lang.Object proxyObject(java.lang.Class targetClass)
          Convenience method for proxying an object without a method prefix.
 java.lang.Object proxyObject(java.lang.String methodPrefix, java.lang.Class targetClass)
          Supports dynamic mapping of Java method calls onto RPC method calls.
protected  void putWriteBuffer(java.net.Socket socket, java.nio.ByteBuffer data)
          Called when data is available to be written to a socket.
protected  void registerChannel(java.nio.channels.SelectableChannel channel)
           
protected  void removeReadBuffer(java.net.Socket socket)
          Called when a complete HTTP message has been identified.
protected  void removeReadBuffers(java.net.Socket socket)
          Called when a a socket is deregistered and any buffers associated with it should be released.
protected  void removeWriteBuffer(java.net.Socket socket)
          Called when a all of the data in a pending write buffer has been written to a socket.
protected  void removeWriteBuffers(java.net.Socket socket)
          Called when a a socket is deregistered and any buffers associated with it should be released.
 void setAcceptEncodedResponses(boolean accept)
           
 void setConnectionPoolLimit(int limit)
          Configure a limit on the number of active connections provided at any given time by the underlying connection pool.
 void setConnectionPoolTimeout(long timeout)
          Configure a timeout value for the underlying connection pool.
 void setContentEncoding(Encoding encoding)
          Set the content encoding to use for
 void setRequestTimeout(long timeout)
          Configure a timeout value for RPC method calls.
protected  void stopImpl()
           
protected  void validateHttpResponse(RpcCall call, HttpResponseBuffer response)
          Validates an HTTP response message, optionally converting it into a local exception.
 
Methods inherited from class com.flat502.rox.processing.HttpRpcProcessor
addWorker, addWorkers, deregisterSocket, getQueue, getSocketSelector, getSSLConfiguration, getSSLSession, getTimer, getWorkerCount, initSelector, isSharedWorkerPool, isStarted, newSSLSession, queueCancellation, queueRead, queueRegistration, queueWrite, queueWrite, read, registerProfiler, registerSocket, registerSSLSessionPolicy, removeWorker, setCipherSuitePattern, setSSLHandshakeTimeout, shouldUseHTTPS, start, stop, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpRpcClient

protected HttpRpcClient(java.net.URL url,
                        ClientResourcePool pool)
                 throws java.io.IOException
Initializes a new instance using the given URL.

Currently only HTTP is supported as a transport.

Parameters:
url - The URL to send method call requests to.
Throws:
java.lang.IllegalArgumentException - if the protocol specified by the given URL is not supported.
java.io.IOException - if an error occurs while initializing the underlying Selector.

HttpRpcClient

protected HttpRpcClient(java.net.URL url,
                        ClientResourcePool pool,
                        SSLConfiguration sslCfg)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

execute

public java.lang.Object execute(java.lang.String name,
                                java.lang.Object[] params)
                         throws java.lang.Exception
Executes the named RPC method call synchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
Returns:
The return value specified in the RPC method response.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public java.lang.Object execute(java.lang.String name,
                                java.lang.Object[] params,
                                java.lang.Class retClass)
                         throws java.lang.Exception
Executes the named RPC method call synchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. The details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
retClass - The class to use when unmarshalling the response if the return value is a struct.
Returns:
The return value specified in the RPC method response.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public java.lang.Object execute(java.lang.String name,
                                java.lang.Object[] params,
                                MethodResponseUnmarshallerAid aid)
                         throws java.lang.Exception
Executes the named RPC method call synchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. The details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
aid - The MethodResponseUnmarshallerAid to use when unmarshalling the response.
Returns:
The return value specified in the RPC method response.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    ResponseHandler handler)
             throws java.lang.Exception
Deprecated. Use execute(String, Object[], AsynchronousResponseHandler) instead.

Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    AsynchronousResponseHandler handler)
             throws java.lang.Exception
Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    java.lang.Class retClass,
                    ResponseHandler handler)
             throws java.lang.Exception
Deprecated. Use execute(String, Object[], Class, AsynchronousResponseHandler) instead.

Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
retClass - The class to use when unmarshalling the response if the return value is a struct.
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    java.lang.Class retClass,
                    AsynchronousResponseHandler handler)
             throws java.lang.Exception
Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
retClass - The class to use when unmarshalling the response if the return value is a struct.
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    MethodResponseUnmarshallerAid aid,
                    ResponseHandler handler)
             throws java.lang.Exception
Deprecated. Use execute(String, Object[], MethodResponseUnmarshallerAid, AsynchronousResponseHandler) instead.

Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
aid - The MethodResponseUnmarshallerAid to use when unmarshalling the response.
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

execute

public void execute(java.lang.String name,
                    java.lang.Object[] params,
                    MethodResponseUnmarshallerAid aid,
                    AsynchronousResponseHandler handler)
             throws java.lang.Exception
Executes the named RPC method call asynchronously, using the parameter list specified.

The type of the return value is dependent on the value encoded within the RPC response. Details are dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
name - The name of the method to execute.
params - The list of parameters to pass along with the method call. This list may be null or empty (these are equivalent).
aid - The MethodResponseUnmarshallerAid to use when unmarshalling the response.
handler - The handler to notify when the response is available.
Throws:
RpcFaultException - if an the remote server responds with an RPC fault.
java.lang.Exception - if any other error occurs while attempting to execute the method call.

proxyObject

public java.lang.Object proxyObject(java.lang.Class targetClass)
                             throws java.lang.Exception
Convenience method for proxying an object without a method prefix.

This is equivalent to invoking proxyObject(String, Class) with a null method prefix.

Parameters:
targetClass - The class to generate a proxy for.
Returns:
A proxy object that will result in RPC calls when methods are invoked.
Throws:
java.lang.Exception - If an error occurs generating the dynamic proxy.
See Also:
Proxy

proxyObject

public java.lang.Object proxyObject(java.lang.String methodPrefix,
                                    java.lang.Class targetClass)
                             throws java.lang.Exception
Supports dynamic mapping of Java method calls onto RPC method calls.

This method generates a dynamic Proxy based on targetClass (which may be an interface) and associates it with this instance. The returned object must implement at least one public interface (it may implement more than one) and is subject to the restrictions discussed under the description of the Proxy class. The returned object may be cast to any of the public interfaces it implements (but not to an instance of targetClass).

Calls made to methods on the returned object are mapped to RPC calls to the remote server this instance is connected to.

How parameters are marshalled is dependent on the particular implementation of the RpcMethod interface this instance is configured to use.

Parameters:
methodPrefix - The prefix to prepend when generating the RPC method name. This may be null, in which case no prefix is used.
targetClass - The class to generate a proxy for.
Returns:
A proxy object that will result in RPC calls when methods are invoked.
Throws:
java.lang.Exception - If an error occurs generating the dynamic proxy.
See Also:
Proxy

setConnectionPoolLimit

public void setConnectionPoolLimit(int limit)
Configure a limit on the number of active connections provided at any given time by the underlying connection pool.

If a non-zero limit is any thread requesting a new connection that would cause this limit to be exceeded will be blocked until an existing connection is returned or until a timeout occurs (if a timeout has been set).

Care should be taken when using the asynchronous execution API without a limit on the connection pool. It's very easy to consume all available local connections like this.

If a non-zero limit is placed on the connection pool then you must be sure to set a timeout on the pool. Failure to do so will result in threads blocking indefinitely when the connection pool is exhausted.

Parameters:
limit - The maximum number of active connections allowed at any given moment. A value of 0 indicates no limit should be enforced (this is the default value).
Throws:
java.lang.IllegalArgumentException - If the timeout provided is negative.
java.lang.IllegalStateException - If any of the execute methods were invoked before this method was invoked.

setConnectionPoolTimeout

public void setConnectionPoolTimeout(long timeout)
Configure a timeout value for the underlying connection pool.

This timeout only applies if a limit has been set on the number of active connections (using setConnectionPoolLimit(int).

If a limit is configured this timeout controls how long a thread will be blocked waiting for a new connection before a ConnectionPoolTimeoutException is raised.

Parameters:
timeout - The timeout (in milliseconds). A value of 0 indicates no timeout should be enforced (this is the default value).
Throws:
java.lang.IllegalArgumentException - If the timeout provided is negative.
java.lang.IllegalStateException - If any of the execute methods were invoked before this method was invoked.

setRequestTimeout

public void setRequestTimeout(long timeout)
Configure a timeout value for RPC method calls.

The new timeout affects only calls executed subsequent to the completion of this method call. Time spent waiting for a connection from the connection pool is not included in this timeout (see setConnectionPoolTimeout(long).

If a method call times out as a result of the timeout configured here an instance of RpcCallTimeoutException will be raised in the case of synchronous calls or, in the case of asynchronous calls, passed to the appropriate response handler.

The connection on which the request that timed out was sent will be closed.

Parameters:
timeout - The timeout (in milliseconds). A value of 0 indicates no timeout should be enforced.
Throws:
java.lang.IllegalArgumentException - If the timeout provided is negative.

setContentEncoding

public void setContentEncoding(Encoding encoding)
Set the content encoding to use for

Parameters:
encoding -

setAcceptEncodedResponses

public void setAcceptEncodedResponses(boolean accept)

deregisterChannel

protected void deregisterChannel(java.nio.channels.SelectableChannel channel)
Overrides:
deregisterChannel in class HttpRpcProcessor

registerChannel

protected void registerChannel(java.nio.channels.SelectableChannel channel)
Overrides:
registerChannel in class HttpRpcProcessor

validateHttpResponse

protected void validateHttpResponse(RpcCall call,
                                    HttpResponseBuffer response)
                             throws java.lang.Exception
Validates an HTTP response message, optionally converting it into a local exception.

This method centralizes (and exposes for replacement by sub-classes) the logic to validate an HTTP response method.

Typically this means converting selected status codes into local exceptions.

This implementation maps all status codes other than 200 onto an exception as follows:

Parameters:
call - The RPC method call the response applies to.
response - The buffer containing the HTTP response.
Throws:
java.lang.Exception - If the status code in the HTTP response is not 200 an exception is raised as described above.

handleTimeout

protected void handleTimeout(java.net.Socket socket,
                             java.lang.Exception cause)
Specified by:
handleTimeout in class HttpRpcProcessor

initialize

protected void initialize()
                   throws java.io.IOException
This implementation defers to the parent implementation before marking this thread as a daemon thread and starting the thread.

Overrides:
initialize in class HttpRpcProcessor
Throws:
java.io.IOException - if an error occurs during initialization.

stopImpl

protected void stopImpl()
                 throws java.io.IOException
Specified by:
stopImpl in class HttpRpcProcessor
Throws:
java.io.IOException

initSocketSSLEngine

protected javax.net.ssl.SSLEngine initSocketSSLEngine(java.net.Socket socket)
                                               throws javax.net.ssl.SSLException
Overrides:
initSocketSSLEngine in class HttpRpcProcessor
Throws:
javax.net.ssl.SSLException

newWorkerPool

protected ResourcePool newWorkerPool()
Description copied from class: HttpRpcProcessor
Factory method for new worker pools.

This is invoked from the constructor to create a new worker pool when one is not provided.

Specified by:
newWorkerPool in class HttpRpcProcessor
Returns:
A new ResourcePool.

handleSelectionKeyOperation

protected void handleSelectionKeyOperation(java.nio.channels.SelectionKey key)
                                    throws java.io.IOException
This implementation defers to the connect(SelectionKey) method if a connection is ready for completion. In all other cases it defers to it's parent.

Overrides:
handleSelectionKeyOperation in class HttpRpcProcessor
Parameters:
key - The SelectionKey for the socket on which an I/O operation is pending.
Throws:
java.io.IOException - if an error occurs while processing the pending event.

connect

protected void connect(java.nio.channels.SelectionKey key)
                throws java.io.IOException
Called when a requested connect operation on a SocketChannel is eligible for completion.

Parameters:
key - The SelectionKey for the socket on which a connection is pending.
Throws:
java.io.IOException - if an error occurs while completing the connection.

handleMessageException

protected void handleMessageException(HttpMessageBuffer msg,
                                      java.lang.Exception e)
Creates a new instance of HttpMessageException and enqueues it on the queue shared by worker threads.

Specified by:
handleMessageException in class HttpRpcProcessor
Parameters:
msg - The HTTP response being processed when the exception occurred.
e - The exception that was raised.

handleProcessingException

protected void handleProcessingException(java.net.Socket socket,
                                         java.lang.Exception e)
Description copied from class: HttpRpcProcessor
An error handler invoked when an error occurs within the main processing loop.

Specified by:
handleProcessingException in class HttpRpcProcessor
Parameters:
socket - The socket the exception is associated with. This may be null if the exception is not specific to a particular socket.
e - The exception that was raised.

handleSSLHandshakeFinished

protected void handleSSLHandshakeFinished(java.net.Socket socket,
                                          javax.net.ssl.SSLEngine engine)
Specified by:
handleSSLHandshakeFinished in class HttpRpcProcessor

getReadBuffer

protected HttpMessageBuffer getReadBuffer(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when data is available on a socket.

Implementations must return a buffer, even if this means creating a new instance. The same buffer should be returned for a given socket until the HttpRpcProcessor.removeReadBuffer(Socket) method is invoked, ensuring that message fragmentation is correctly handled.

Specified by:
getReadBuffer in class HttpRpcProcessor
Parameters:
socket - The socket on which data has arrived.
Returns:
A message buffer for the given socket.

removeReadBuffer

protected void removeReadBuffer(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when a complete HTTP message has been identified.

Specified by:
removeReadBuffer in class HttpRpcProcessor
Parameters:
socket - The socket on which a complete message has been received.

removeReadBuffers

protected void removeReadBuffers(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when a a socket is deregistered and any buffers associated with it should be released.

Specified by:
removeReadBuffers in class HttpRpcProcessor
Parameters:
socket - The socket on which a complete message has been received.

putWriteBuffer

protected void putWriteBuffer(java.net.Socket socket,
                              java.nio.ByteBuffer data)
Description copied from class: HttpRpcProcessor
Called when data is available to be written to a socket.

Specified by:
putWriteBuffer in class HttpRpcProcessor
Parameters:
socket - The socket on which the data should be sent.
data - The data to be written.

isWriteQueued

protected boolean isWriteQueued(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called to find out if data is queued to be written to a socket.

Specified by:
isWriteQueued in class HttpRpcProcessor
Parameters:
socket - The socket on which the data should be sent.
Returns:
true if there is a buffer waiting to be written on the given socket

getWriteBuffer

protected java.nio.ByteBuffer getWriteBuffer(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when a socket becomes available for writing.

Implementations should return a buffer only if one has been added using HttpRpcProcessor.putWriteBuffer(Socket, ByteBuffer). The same buffer should be returned for a given socket until the HttpRpcProcessor.removeWriteBuffer(Socket) method is invoked, ensuring that large messages that must be written in multiple fragments are correctly handled.

Specified by:
getWriteBuffer in class HttpRpcProcessor
Parameters:
socket - The socket that is available for writing.
Returns:
A data buffer for the given socket.

removeWriteBuffer

protected void removeWriteBuffer(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when a all of the data in a pending write buffer has been written to a socket.

Specified by:
removeWriteBuffer in class HttpRpcProcessor
Parameters:
socket - The socket the buffer was associated with.

removeWriteBuffers

protected void removeWriteBuffers(java.net.Socket socket)
Description copied from class: HttpRpcProcessor
Called when a a socket is deregistered and any buffers associated with it should be released.

Specified by:
removeWriteBuffers in class HttpRpcProcessor
Parameters:
socket - The socket the buffer was associated with.

newHttpRequest

protected HttpRequest newHttpRequest(RpcCall call)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getUserAgent

protected java.lang.String getUserAgent()

newRpcResponseContext

protected RpcResponseContext newRpcResponseContext(java.net.Socket socket,
                                                   HttpResponseBuffer rsp)

newRpcCall

protected abstract RpcCall newRpcCall(java.lang.String name,
                                      java.lang.Object[] params)

getMethodResponseUnmarshaller

protected abstract MethodResponseUnmarshaller getMethodResponseUnmarshaller()
Retrieves an MethodResponseUnmarshaller instance for unmarshalling incoming RpcResponses.

Implementations may return the same unmarshaller instance for each call to this method as long as that unmarshaller is thread-safe.

Returns:
An appropriately initialized unmarshaller.