solar.service.rpc
Class SolarRpcService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.rpc.SolarRpcService
All Implemented Interfaces:
EventHandler, RequestHandler, RpcService, Service

public class SolarRpcService
extends BaseService
implements RpcService

An implementation of RPC service and it requires a dispatch service.

Version:
$Id: SolarRpcService.java,v 1.16 2003/10/05 18:51:01 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class SolarRpcService.RpcWorker
          A worker thread to handle one RPC request.
 
Field Summary
protected  DispatchService _dispatch
          Dependent dispatch service.
protected static org.apache.log4j.Logger _log
          Logging facility.
protected  ServiceManager _manager
          The service manager.
protected static RpcAck _rpcAck
          The reusable RPC acknowledge object.
protected  java.lang.String _rpcName
          The name of this RPC service.
protected  java.lang.String _transportName
          The name of transport service used.
 
Fields inherited from class solar.service.BaseService
_inited, _name
 
Constructor Summary
SolarRpcService()
           
 
Method Summary
private  void dohandleReply(ReplyEvent evt)
           
private  void doHandleRequest(RequestEvent evt, Address source)
           
 void handleDispatchUnit(DispatchUnit dunit)
          Handle the data unit delivered by dispatch service.
 java.lang.Object handleRequest(Request req)
          Processing a request.
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
 java.lang.Object invoke(Address dest, java.lang.String handler, Request req)
          Send the request to remote party and wait for the result.
 java.lang.Object invoke(Address dest, java.lang.String handler, Request req, long timeout)
          Send the request and wait for the result for a fixed period.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleEvent, handleEvent, hasInited, init, setInited, setName, setServiceManager, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface solar.service.Service
getName, getServiceManager, hasInited, setName, setServiceManager, start, stop
 
Methods inherited from interface solar.api.EventHandler
handleEvent
 

Field Detail

_log

protected static org.apache.log4j.Logger _log
Logging facility.


_dispatch

protected DispatchService _dispatch
Dependent dispatch service.


_manager

protected ServiceManager _manager
The service manager.


_rpcName

protected java.lang.String _rpcName
The name of this RPC service.


_rpcAck

protected static final RpcAck _rpcAck
The reusable RPC acknowledge object.


_transportName

protected java.lang.String _transportName
The name of transport service used.

Constructor Detail

SolarRpcService

public SolarRpcService()
Method Detail

init

public void init()
          throws ServiceException
Description copied from interface: Service
Initiate the service, do not try to init dependent services here.

Specified by:
init in interface Service
Overrides:
init in class BaseService
ServiceException

initDependents

public void initDependents()
                    throws ServiceException
Description copied from interface: Service
Initialize dependent services here.

Specified by:
initDependents in interface Service
Overrides:
initDependents in class BaseService
ServiceException

handleDispatchUnit

public void handleDispatchUnit(DispatchUnit dunit)
                        throws java.lang.Exception
Description copied from interface: Service
Handle the data unit delivered by dispatch service.

Specified by:
handleDispatchUnit in interface Service
Overrides:
handleDispatchUnit in class BaseService
java.lang.Exception

handleRequest

public java.lang.Object handleRequest(Request req)
                               throws java.lang.Exception
Description copied from interface: RequestHandler
Processing a request.

Specified by:
handleRequest in interface RequestHandler
Overrides:
handleRequest in class BaseService
java.lang.Exception

dohandleReply

private void dohandleReply(ReplyEvent evt)

doHandleRequest

private void doHandleRequest(RequestEvent evt,
                             Address source)

invoke

public java.lang.Object invoke(Address dest,
                               java.lang.String handler,
                               Request req)
                        throws RpcException
Description copied from interface: RpcService
Send the request to remote party and wait for the result.

Specified by:
invoke in interface RpcService
RpcException

invoke

public java.lang.Object invoke(Address dest,
                               java.lang.String handler,
                               Request req,
                               long timeout)
                        throws RpcException
Description copied from interface: RpcService
Send the request and wait for the result for a fixed period.

Specified by:
invoke in interface RpcService
RpcException