com.flat502.rox.demo
Class AsyncServerDemo

java.lang.Object
  extended by com.flat502.rox.demo.AsyncServerDemo
All Implemented Interfaces:
AsynchronousRequestHandler, RequestHandler

public class AsyncServerDemo
extends java.lang.Object
implements AsynchronousRequestHandler

A demo asynchronous server illustrating the AsynchronousRequestHandler interface.


Constructor Summary
AsyncServerDemo()
           
 
Method Summary
 void handleRequest(RpcCall call, RpcCallContext context, ResponseChannel rspChannel)
          Invoked to handle a method call.
static void main(java.lang.String[] args)
          Start an instance of this demo server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncServerDemo

public AsyncServerDemo()
Method Detail

handleRequest

public void handleRequest(RpcCall call,
                          RpcCallContext context,
                          ResponseChannel rspChannel)
                   throws java.lang.Exception
Description copied from interface: AsynchronousRequestHandler
Invoked to handle a method call.

This method is responsible for processing the method asynchronously. Responses can be sent using the ResponseChannel.respond(RpcResponse) method.

Although an implement could do all of its work using the calling thread the intention of this interface is to support handing off the work to an application thread.

The caller is one of the underlying worker threads (see HttpRpcProcessor.addWorker()) and as such should process the method as quickly as possible.

If an exception is raised it will be returned to the caller as an RPC fault.

Specified by:
handleRequest in interface AsynchronousRequestHandler
Parameters:
call - The method call to be handled.
context - An RpcCallContext instance providing information about the call context.
rspChannel - A handle to a logic channel that can be used when a response is ready.
Throws:
java.lang.Exception - Implementations are permitted to raise an exception as part of their processing.

main

public static void main(java.lang.String[] args)
Start an instance of this demo server.

The following XML-RPC methods are supported by this server:

Parameters:
args - A list of parameters indicating the host/address and port to bind to. These default to localhost and 8080 if not specified.