solar.service.routing
Class ManualRoutingService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.routing.ManualRoutingService
All Implemented Interfaces:
Cache.CacheListener, EventHandler, RequestHandler, RoutingConstants, RoutingService, Service
Direct Known Subclasses:
DirectRoutingService

public class ManualRoutingService
extends BaseService
implements RoutingService, Cache.CacheListener, RoutingConstants

The routing table is manually setup as the overlay network is being constructed. The construction follows one simple rule: each node is added peering with an existing one. The spanning tree resulted from such construction forms the routing table. This service requires a transport, a cache, and a timer services. The valid properties are:

Version:
$Id: ManualRoutingService.java,v 1.27 2003/10/05 18:51:01 glchen Exp $ TODO: To prevent loop (maintain a spanning tree) during recovery phase.
Author:
Guanling Chen

Nested Class Summary
(package private)  class ManualRoutingService.RoutingTask
          A periodic routing task.
 
Field Summary
protected  DispatchService _dispatch
           
protected  long _interval
           
protected  org.apache.log4j.Logger _log
           
protected  Cache _nearby
           
protected  Address _peer
           
protected  Cache _remote
           
protected  java.lang.String _routingName
           
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.routing.RoutingConstants
ROUTING_HOST, ROUTING_INTERVAL, ROUTING_LASTHOP, ROUTING_SOURCE
 
Constructor Summary
ManualRoutingService()
           
 
Method Summary
 Address getNextHop(Address dest)
          Return the next hop for the messages with specified destination.
 void handleEvent(Event evt)
          Processing an event.
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
 void notifyObjectExpired(CachedObject co)
          Notify when an object has expired from the cache.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, handleRequest, 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
 
Methods inherited from interface solar.api.RequestHandler
handleRequest
 

Field Detail

_log

protected org.apache.log4j.Logger _log

_peer

protected Address _peer

_interval

protected long _interval

_nearby

protected Cache _nearby

_remote

protected Cache _remote

_routingName

protected java.lang.String _routingName

_transportName

protected java.lang.String _transportName

_transportAddress

protected Address _transportAddress

_timer

protected java.util.Timer _timer

_dispatch

protected DispatchService _dispatch
Constructor Detail

ManualRoutingService

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

notifyObjectExpired

public void notifyObjectExpired(CachedObject co)
Description copied from interface: Cache.CacheListener
Notify when an object has expired from the cache.

Specified by:
notifyObjectExpired in interface Cache.CacheListener

handleEvent

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

Specified by:
handleEvent in interface EventHandler
Overrides:
handleEvent in class BaseService
java.lang.Exception

getNextHop

public Address getNextHop(Address dest)
                   throws RoutingException
Description copied from interface: RoutingService
Return the next hop for the messages with specified destination.

Specified by:
getNextHop in interface RoutingService
RoutingException