urv.machannel
Class MChannelImpl

java.lang.Object
  extended by org.jgroups.blocks.PullPushAdapter
      extended by urv.machannel.MChannelImpl
All Implemented Interfaces:
java.lang.Runnable, org.jgroups.ChannelListener, MChannel

public class MChannelImpl
extends org.jgroups.blocks.PullPushAdapter
implements MChannel

This class provides an implementation of the MChannel interface in order to group communication with topology awareness.

Version:
$Revision
Author:
Marcel Arrufat, Gerard París, Raúl Gracia

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgroups.blocks.PullPushAdapter
org.jgroups.blocks.PullPushAdapter.PullHeader
 
Field Summary
 
Fields inherited from class org.jgroups.blocks.PullPushAdapter
listener, listeners, log, membership_listeners, receiver_thread, transport
 
Constructor Summary
MChannelImpl(org.jgroups.Transport channel, MulticastAddress mcastAddr, java.lang.String channelName, EmulationController controller)
           
 
Method Summary
 void close()
          Stops the channel
 java.lang.String getChannelName()
          This method retrieves the name of the channel
 java.util.List<java.net.InetAddress> getInetAddressesOfGroupMebers()
          Return the InetAddresses of the group members
 org.jgroups.Address getLocalAddress()
          Returns the Address of the Local Node
 NetworkGraph<OLSRNode,Weight> getNetworkGraph()
          Retrieves the NetworkGraph with the topology below us
 org.jgroups.View getView()
          Returns a view with the members of the current group
protected  void notifyViewChange(org.jgroups.View topologyEvent)
           
 void registerListener(java.io.Serializable identifier, org.jgroups.MessageListener l)
          Removes a Message listener from the transport layer
 void run()
          Reentrant run(): message reception is serialized, then the listener is notified of the message reception
 void send(org.jgroups.Address dst, org.jgroups.Address src, java.io.Serializable content)
          Sends a message to a selected peer
 void send(org.jgroups.Message msg)
          Sends a message to all peers in a group
 void sendToNeighbors(java.io.Serializable content)
          Sends a message to all the neighbors of the localNode in this group
 void unregisterListener(java.io.Serializable identifier)
          Add a Message listener in the transport layer
 
Methods inherited from class org.jgroups.blocks.PullPushAdapter
addMembershipListener, channelClosed, channelConnected, channelDisconnected, channelReconnected, channelShunned, getListener, getTransport, handleMessage, notifyBlock, notifySuspect, notifyUnblock, removeMembershipListener, send, setListener, setMembershipListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MChannelImpl

public MChannelImpl(org.jgroups.Transport channel,
                    MulticastAddress mcastAddr,
                    java.lang.String channelName,
                    EmulationController controller)
Method Detail

getLocalAddress

public org.jgroups.Address getLocalAddress()
Description copied from interface: MChannel
Returns the Address of the Local Node

Specified by:
getLocalAddress in interface MChannel
Returns:
local Address

getNetworkGraph

public NetworkGraph<OLSRNode,Weight> getNetworkGraph()
Description copied from interface: MChannel
Retrieves the NetworkGraph with the topology below us

Specified by:
getNetworkGraph in interface MChannel
Returns:
Topology Graph

getView

public org.jgroups.View getView()
Description copied from interface: MChannel
Returns a view with the members of the current group

Specified by:
getView in interface MChannel
Returns:
Members
See Also:
View

getChannelName

public java.lang.String getChannelName()
Description copied from interface: MChannel
This method retrieves the name of the channel

Specified by:
getChannelName in interface MChannel
Returns:
MChannelName

run

public void run()
Reentrant run(): message reception is serialized, then the listener is notified of the message reception

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class org.jgroups.blocks.PullPushAdapter

send

public void send(org.jgroups.Message msg)
Sends a message to all peers in a group

Specified by:
send in interface MChannel
Overrides:
send in class org.jgroups.blocks.PullPushAdapter

send

public void send(org.jgroups.Address dst,
                 org.jgroups.Address src,
                 java.io.Serializable content)
Sends a message to a selected peer

Specified by:
send in interface MChannel

sendToNeighbors

public void sendToNeighbors(java.io.Serializable content)
Sends a message to all the neighbors of the localNode in this group

Specified by:
sendToNeighbors in interface MChannel

getInetAddressesOfGroupMebers

public java.util.List<java.net.InetAddress> getInetAddressesOfGroupMebers()
Description copied from interface: MChannel
Return the InetAddresses of the group members

Specified by:
getInetAddressesOfGroupMebers in interface MChannel
Returns:
addressesOfGroupMembers

close

public void close()
Description copied from interface: MChannel
Stops the channel

Specified by:
close in interface MChannel

notifyViewChange

protected void notifyViewChange(org.jgroups.View topologyEvent)
Overrides:
notifyViewChange in class org.jgroups.blocks.PullPushAdapter

registerListener

public void registerListener(java.io.Serializable identifier,
                             org.jgroups.MessageListener l)
Description copied from interface: MChannel
Removes a Message listener from the transport layer

Specified by:
registerListener in interface MChannel
Overrides:
registerListener in class org.jgroups.blocks.PullPushAdapter
See Also:
PullPushAdapter

unregisterListener

public void unregisterListener(java.io.Serializable identifier)
Description copied from interface: MChannel
Add a Message listener in the transport layer

Specified by:
unregisterListener in interface MChannel
Overrides:
unregisterListener in class org.jgroups.blocks.PullPushAdapter
See Also:
PullPushAdapter