org.codehaus.wadi.gridstate.jgroups
Class JGroupsDispatcher

java.lang.Object
  extended byorg.codehaus.wadi.gridstate.impl.AbstractDispatcher
      extended byorg.codehaus.wadi.gridstate.jgroups.JGroupsDispatcher
All Implemented Interfaces:
org.codehaus.wadi.gridstate.Dispatcher, org.jgroups.MembershipListener, org.jgroups.MessageListener, MessageListener

public class JGroupsDispatcher
extends org.codehaus.wadi.gridstate.impl.AbstractDispatcher
implements org.jgroups.MessageListener, org.jgroups.MembershipListener

A Dispatcher for JGroups

Version:
$Revision: 1363 $
Author:
Jules Gosnell

Nested Class Summary
 
Nested classes inherited from class org.codehaus.wadi.gridstate.Dispatcher
org.codehaus.wadi.gridstate.Dispatcher.InternalDispatcher
 
Field Summary
protected  org.jgroups.Channel _channel
           
protected  JGroupsCluster _cluster
           
protected  Destination _clusterDestination
           
protected  Map _clusterState
           
protected  org.jgroups.blocks.MessageDispatcher _dispatcher
           
protected  ClusterListener _listener
           
protected  Destination _localDestination
           
protected  Map _localState
           
protected  Vector _members
           
protected  Map _nodes
           
protected  Object _viewLock
           
 
Fields inherited from class org.codehaus.wadi.gridstate.impl.AbstractDispatcher
_clusterName, _config, _executor, _factory, _inactiveTime, _log, _map, _messageLog, _nodeName, _rvMap
 
Constructor Summary
JGroupsDispatcher(String nodeName, String clusterName, long inactiveTime)
           
 
Method Summary
 void block()
           
 ObjectMessage createObjectMessage()
           
protected  Node ensureNode(org.jgroups.Address address)
           
 void findRelevantSessionNames(int numPartitions, Collection[] resultSet)
           
 Destination getClusterDestination()
           
 Map getDistributedState()
           
 String getIncomingCorrelationId(ObjectMessage message)
           
 Destination getLocalDestination()
           
 String getNodeName(Destination destination)
           
 int getNumNodes()
           
 String getOutgoingCorrelationId(ObjectMessage message)
           
 byte[] getState()
           
protected  Map getState(org.jgroups.Address address)
           
 void init(org.codehaus.wadi.gridstate.DispatcherConfig config)
           
 void onMessage(ObjectMessage message, JGroupsStateUpdate update)
           
 void receive(org.jgroups.Message msg)
           
 void send(Destination to, ObjectMessage message)
           
 void setClusterListener(ClusterListener listener)
           
 void setDistributedState(Map state)
           
 void setIncomingCorrelationId(ObjectMessage message, String correlationId)
           
 void setOutgoingCorrelationId(ObjectMessage message, String correlationId)
           
 void setState(byte[] state)
           
 void start()
           
 void stop()
           
 void suspect(org.jgroups.Address suspected_mbr)
           
 void viewAccepted(org.jgroups.View newView)
           
 
Methods inherited from class org.codehaus.wadi.gridstate.impl.AbstractDispatcher
attemptRendezVous, deregister, exchangeReply, exchangeReplyLoop, exchangeSend, exchangeSend, exchangeSend, exchangeSendLoop, forward, forward, getExecutor, getInactiveTime, getNodeName, getRendezVousMap, newDeregister, newRegister, nextCorrelationId, onMessage, register, register, reply, reply, send, setRendezVous
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_clusterDestination

protected final Destination _clusterDestination

_clusterState

protected final Map _clusterState

_channel

protected org.jgroups.Channel _channel

_dispatcher

protected org.jgroups.blocks.MessageDispatcher _dispatcher

_localDestination

protected Destination _localDestination

_localState

protected Map _localState

_members

protected Vector _members

_cluster

protected JGroupsCluster _cluster

_viewLock

protected final Object _viewLock

_listener

protected ClusterListener _listener

_nodes

protected final Map _nodes
Constructor Detail

JGroupsDispatcher

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

receive

public void receive(org.jgroups.Message msg)
Specified by:
receive in interface org.jgroups.MessageListener

getState

public byte[] getState()
Specified by:
getState in interface org.jgroups.MessageListener

setState

public void setState(byte[] state)
Specified by:
setState in interface org.jgroups.MessageListener

init

public void init(org.codehaus.wadi.gridstate.DispatcherConfig config)
          throws Exception
Specified by:
init in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

getNumNodes

public int getNumNodes()
Specified by:
getNumNodes in interface org.codehaus.wadi.gridstate.Dispatcher

createObjectMessage

public ObjectMessage createObjectMessage()
Specified by:
createObjectMessage in interface org.codehaus.wadi.gridstate.Dispatcher

send

public void send(Destination to,
                 ObjectMessage message)
          throws Exception
Specified by:
send in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

getState

protected Map getState(org.jgroups.Address address)

getNodeName

public String getNodeName(Destination destination)
Specified by:
getNodeName in interface org.codehaus.wadi.gridstate.Dispatcher

getLocalDestination

public Destination getLocalDestination()
Specified by:
getLocalDestination in interface org.codehaus.wadi.gridstate.Dispatcher

getClusterDestination

public Destination getClusterDestination()
Specified by:
getClusterDestination in interface org.codehaus.wadi.gridstate.Dispatcher

getDistributedState

public Map getDistributedState()
Specified by:
getDistributedState in interface org.codehaus.wadi.gridstate.Dispatcher

setDistributedState

public void setDistributedState(Map state)
                         throws Exception
Specified by:
setDistributedState in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

onMessage

public void onMessage(ObjectMessage message,
                      JGroupsStateUpdate update)
               throws Exception
Throws:
Exception

getIncomingCorrelationId

public String getIncomingCorrelationId(ObjectMessage message)
                                throws Exception
Specified by:
getIncomingCorrelationId in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

setIncomingCorrelationId

public void setIncomingCorrelationId(ObjectMessage message,
                                     String correlationId)
                              throws Exception
Specified by:
setIncomingCorrelationId in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

getOutgoingCorrelationId

public String getOutgoingCorrelationId(ObjectMessage message)
                                throws Exception
Specified by:
getOutgoingCorrelationId in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

setOutgoingCorrelationId

public void setOutgoingCorrelationId(ObjectMessage message,
                                     String correlationId)
                              throws Exception
Specified by:
setOutgoingCorrelationId in interface org.codehaus.wadi.gridstate.Dispatcher
Throws:
Exception

findRelevantSessionNames

public void findRelevantSessionNames(int numPartitions,
                                     Collection[] resultSet)

viewAccepted

public void viewAccepted(org.jgroups.View newView)
Specified by:
viewAccepted in interface org.jgroups.MembershipListener

suspect

public void suspect(org.jgroups.Address suspected_mbr)
Specified by:
suspect in interface org.jgroups.MembershipListener

block

public void block()
Specified by:
block in interface org.jgroups.MembershipListener

setClusterListener

public void setClusterListener(ClusterListener listener)
Specified by:
setClusterListener in interface org.codehaus.wadi.gridstate.Dispatcher

ensureNode

protected Node ensureNode(org.jgroups.Address address)


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