solar.service.fork
Class SolarForkService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.fork.SolarForkService
All Implemented Interfaces:
EventHandler, ForkService, RequestHandler, RpcConstants, Service, TaskBatch.BatchListener

public class SolarForkService
extends BaseService
implements ForkService, TaskBatch.BatchListener, RpcConstants

An implementation of forking service. It reads a configuration file and sends requests to fork services on other hosts.

Version:
$Id: SolarForkService.java,v 1.3 2003/10/08 22:53:22 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class SolarForkService.KillTask
           
(package private)  class SolarForkService.StartTask
           
 
Field Summary
protected  TaskBatch _batch
           
protected  DispatchService _dispatch
           
protected  java.lang.String _forkName
           
protected static org.apache.log4j.Logger _log
           
protected  java.util.Hashtable _process
           
protected  RpcService _rpc
           
protected  java.util.Timer _timer
           
protected  Address _transportAddress
           
protected  java.lang.String _transportName
           
 
Fields inherited from class solar.service.BaseService
_inited, _manager, _name
 
Fields inherited from interface solar.service.rpc.RpcConstants
RPC_BLOCK, RPC_HANDLER, RPC_REPLY, RPC_REQUEST, RPC_TIMEOUT
 
Constructor Summary
SolarForkService()
           
 
Method Summary
 void batchFinished()
           
 void batchrun(java.lang.String taskfile)
           
 void destroy(Id id, Address dest)
          Execute a previously created process at specified address.
 void handleEvent(Event evt)
          Processing an event.
 java.lang.Object handleRequest(Request request)
          Processing a request.
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
 void start(Id id, Address dest, java.lang.String cmd)
          Execute a command on specified address.
 void startTask(Task task)
           
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, 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, handleDispatchUnit, hasInited, setName, setServiceManager, start, stop
 

Field Detail

_log

protected static org.apache.log4j.Logger _log

_forkName

protected java.lang.String _forkName

_transportName

protected java.lang.String _transportName

_transportAddress

protected Address _transportAddress

_rpc

protected RpcService _rpc

_dispatch

protected DispatchService _dispatch

_batch

protected TaskBatch _batch

_timer

protected java.util.Timer _timer

_process

protected java.util.Hashtable _process
Constructor Detail

SolarForkService

public SolarForkService()
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

handleEvent

public void handleEvent(Event evt)
Description copied from interface: EventHandler
Processing an event.

Specified by:
handleEvent in interface EventHandler
Overrides:
handleEvent in class BaseService

handleRequest

public java.lang.Object handleRequest(Request request)
                               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

start

public void start(Id id,
                  Address dest,
                  java.lang.String cmd)
           throws ForkException
Description copied from interface: ForkService
Execute a command on specified address.

Specified by:
start in interface ForkService
ForkException

destroy

public void destroy(Id id,
                    Address dest)
             throws ForkException
Description copied from interface: ForkService
Execute a previously created process at specified address.

Specified by:
destroy in interface ForkService
ForkException

batchrun

public void batchrun(java.lang.String taskfile)
              throws ForkException
Specified by:
batchrun in interface ForkService
ForkException

startTask

public void startTask(Task task)
               throws java.lang.Exception
Specified by:
startTask in interface TaskBatch.BatchListener
java.lang.Exception

batchFinished

public void batchFinished()
Specified by:
batchFinished in interface TaskBatch.BatchListener