org.codehaus.wadi.gridstate.impl
Class AbstractDispatcher

java.lang.Object
  extended byorg.codehaus.wadi.gridstate.impl.AbstractDispatcher
All Implemented Interfaces:
Dispatcher, MessageListener
Direct Known Subclasses:
ActiveClusterDispatcher

public abstract class AbstractDispatcher
extends Object
implements Dispatcher, MessageListener

The portable aspects of a Dispatcher implementation

Version:
$Revision: 1430 $
Author:
Jules Gosnell

Nested Class Summary
 
Nested classes inherited from class org.codehaus.wadi.gridstate.Dispatcher
Dispatcher.InternalDispatcher
 
Field Summary
protected  String _clusterName
           
protected  DispatcherConfig _config
           
protected  PooledExecutor _executor
           
protected  org.codehaus.wadi.gridstate.impl.AbstractDispatcher.SimpleCorrelationIDFactory _factory
           
protected  long _inactiveTime
           
protected  Log _log
           
protected  Map _map
           
protected  Log _messageLog
           
protected  String _nodeName
           
protected  Map _rvMap
           
 
Constructor Summary
AbstractDispatcher(String nodeName, String clusterName, long inactiveTime)
           
 
Method Summary
 ObjectMessage attemptRendezVous(String correlationId, Quipu rv, long timeout)
           
 boolean deregister(String methodName, Class type, int timeout)
           
 ObjectMessage exchangeReply(ObjectMessage message, Serializable body, long timeout)
           
 ObjectMessage exchangeReplyLoop(ObjectMessage message, Serializable body, long timeout)
           
 ObjectMessage exchangeSend(Destination from, Destination to, Serializable body, long timeout)
           
 ObjectMessage exchangeSend(Destination from, Destination to, Serializable body, long timeout, String targetCorrelationId)
           
 ObjectMessage exchangeSend(Destination from, Destination to, String outgoingCorrelationId, Serializable body, long timeout)
           
 ObjectMessage exchangeSendLoop(Destination from, Destination to, Serializable body, long timeout, int iterations)
           
 boolean forward(ObjectMessage message, Destination destination)
           
 boolean forward(ObjectMessage message, Destination destination, Serializable body)
           
 PooledExecutor getExecutor()
           
 long getInactiveTime()
           
 String getNodeName()
           
 Map getRendezVousMap()
           
 void init(DispatcherConfig config)
           
 boolean newDeregister(String methodName, Class type, int timeout)
           
 Dispatcher.InternalDispatcher newRegister(Object target, String methodName, Class type)
           
 String nextCorrelationId()
           
 void onMessage(Message message)
           
 void register(Class type, long timeout)
           
 Dispatcher.InternalDispatcher register(Object target, String methodName, Class type)
           
 boolean reply(Destination from, Destination to, String incomingCorrelationId, Serializable body)
           
 boolean reply(ObjectMessage message, Serializable body)
           
 boolean send(Destination from, Destination to, String outgoingCorrelationId, Serializable body)
           
 Quipu setRendezVous(String correlationId, int numLlamas)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.wadi.gridstate.Dispatcher
createObjectMessage, getClusterDestination, getDistributedState, getIncomingCorrelationId, getLocalDestination, getNodeName, getNumNodes, getOutgoingCorrelationId, send, setClusterListener, setDistributedState, setIncomingCorrelationId, setOutgoingCorrelationId, start, stop
 

Field Detail

_nodeName

protected final String _nodeName

_clusterName

protected final String _clusterName

_inactiveTime

protected final long _inactiveTime

_map

protected final Map _map

_executor

protected final PooledExecutor _executor

_messageLog

protected final Log _messageLog

_log

protected Log _log

_config

protected DispatcherConfig _config

_rvMap

protected final Map _rvMap

_factory

protected final org.codehaus.wadi.gridstate.impl.AbstractDispatcher.SimpleCorrelationIDFactory _factory
Constructor Detail

AbstractDispatcher

public AbstractDispatcher(String nodeName,
                          String clusterName,
                          long inactiveTime)
Method Detail

init

public void init(DispatcherConfig config)
          throws Exception
Specified by:
init in interface Dispatcher
Throws:
Exception

register

public Dispatcher.InternalDispatcher register(Object target,
                                              String methodName,
                                              Class type)
Specified by:
register in interface Dispatcher

newRegister

public Dispatcher.InternalDispatcher newRegister(Object target,
                                                 String methodName,
                                                 Class type)
Specified by:
newRegister in interface Dispatcher

deregister

public boolean deregister(String methodName,
                          Class type,
                          int timeout)
Specified by:
deregister in interface Dispatcher

newDeregister

public boolean newDeregister(String methodName,
                             Class type,
                             int timeout)
Specified by:
newDeregister in interface Dispatcher

register

public void register(Class type,
                     long timeout)
Specified by:
register in interface Dispatcher

getRendezVousMap

public Map getRendezVousMap()
Specified by:
getRendezVousMap in interface Dispatcher

nextCorrelationId

public String nextCorrelationId()
Specified by:
nextCorrelationId in interface Dispatcher

setRendezVous

public Quipu setRendezVous(String correlationId,
                           int numLlamas)
Specified by:
setRendezVous in interface Dispatcher

attemptRendezVous

public ObjectMessage attemptRendezVous(String correlationId,
                                       Quipu rv,
                                       long timeout)
Specified by:
attemptRendezVous in interface Dispatcher

getExecutor

public PooledExecutor getExecutor()
Specified by:
getExecutor in interface Dispatcher

exchangeSendLoop

public ObjectMessage exchangeSendLoop(Destination from,
                                      Destination to,
                                      Serializable body,
                                      long timeout,
                                      int iterations)
Specified by:
exchangeSendLoop in interface Dispatcher

exchangeSend

public ObjectMessage exchangeSend(Destination from,
                                  Destination to,
                                  Serializable body,
                                  long timeout)
Specified by:
exchangeSend in interface Dispatcher

onMessage

public void onMessage(Message message)
Specified by:
onMessage in interface MessageListener

reply

public boolean reply(ObjectMessage message,
                     Serializable body)
Specified by:
reply in interface Dispatcher

send

public boolean send(Destination from,
                    Destination to,
                    String outgoingCorrelationId,
                    Serializable body)
Specified by:
send in interface Dispatcher

exchangeSend

public ObjectMessage exchangeSend(Destination from,
                                  Destination to,
                                  Serializable body,
                                  long timeout,
                                  String targetCorrelationId)
Specified by:
exchangeSend in interface Dispatcher

exchangeSend

public ObjectMessage exchangeSend(Destination from,
                                  Destination to,
                                  String outgoingCorrelationId,
                                  Serializable body,
                                  long timeout)
Specified by:
exchangeSend in interface Dispatcher

reply

public boolean reply(Destination from,
                     Destination to,
                     String incomingCorrelationId,
                     Serializable body)
Specified by:
reply in interface Dispatcher

exchangeReply

public ObjectMessage exchangeReply(ObjectMessage message,
                                   Serializable body,
                                   long timeout)
Specified by:
exchangeReply in interface Dispatcher

exchangeReplyLoop

public ObjectMessage exchangeReplyLoop(ObjectMessage message,
                                       Serializable body,
                                       long timeout)
Specified by:
exchangeReplyLoop in interface Dispatcher

forward

public boolean forward(ObjectMessage message,
                       Destination destination)
Specified by:
forward in interface Dispatcher

forward

public boolean forward(ObjectMessage message,
                       Destination destination,
                       Serializable body)
Specified by:
forward in interface Dispatcher

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Dispatcher

getInactiveTime

public long getInactiveTime()
Specified by:
getInactiveTime in interface Dispatcher


Copyright © 2004-2008 Core Developers Network Ltd.. All Rights Reserved.