org.jgroups.protocols
Class UDP1_4.ConnectorTable

java.lang.Object
  extended byorg.jgroups.protocols.UDP1_4.ConnectorTable
All Implemented Interfaces:
org.jgroups.protocols.Receiver, java.lang.Runnable
Enclosing class:
UDP1_4

public static class UDP1_4.ConnectorTable
extends java.lang.Object
implements org.jgroups.protocols.Receiver, java.lang.Runnable

Manages a bunch of Connectors


Constructor Summary
UDP1_4.ConnectorTable(java.net.InetSocketAddress mcast_addr, int receive_buffer_size, int receive_sock_buf_size, boolean ip_mcast, org.jgroups.protocols.Receiver receiver)
           
 
Method Summary
 java.util.List getConnectorAddresses()
          Returns a list of local addresses (one for each Connector)
 org.jgroups.protocols.Receiver getReceiver()
           
 void listenOn(java.lang.String bind_interface, int local_port, int port_range, int receive_buffer_size, int receiver_sock_buf_size, int send_sock_buf_size, int ip_ttl, org.jgroups.protocols.Receiver receiver)
          Adds the given interface address to the list of interfaces on which the receiver mcast socket has to listen.
 void receive(java.net.DatagramPacket packet)
          Called when data has been received on a socket.
static void receivePacket(java.net.DatagramPacket packet, java.net.DatagramSocket sock, org.jgroups.protocols.Receiver receiver)
           
 void run()
           
 void send(java.net.DatagramPacket msg)
          Sends a packet.
 void setReceiver(org.jgroups.protocols.Receiver receiver)
           
 void start()
          Get all interfaces, create one Connector per interface and call start() on it
 void stop()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UDP1_4.ConnectorTable

public UDP1_4.ConnectorTable(java.net.InetSocketAddress mcast_addr,
                             int receive_buffer_size,
                             int receive_sock_buf_size,
                             boolean ip_mcast,
                             org.jgroups.protocols.Receiver receiver)
                      throws java.io.IOException
Method Detail

getReceiver

public org.jgroups.protocols.Receiver getReceiver()

setReceiver

public void setReceiver(org.jgroups.protocols.Receiver receiver)

start

public void start()
           throws java.lang.Exception
Get all interfaces, create one Connector per interface and call start() on it

Throws:
java.lang.Exception

stop

public void stop()

run

public void run()
Specified by:
run in interface java.lang.Runnable

getConnectorAddresses

public java.util.List getConnectorAddresses()
Returns a list of local addresses (one for each Connector)

Returns:
List

send

public void send(java.net.DatagramPacket msg)
          throws java.lang.Exception
Sends a packet. If the destination is a multicast address, call send() on all connectors. If destination is not null, send the message using any Connector: if we send a unicast message, it doesn't matter to which interface we are bound; the kernel will choose the correct interface based on the destination and the routing table. Note that the receiver will have the interface which was chosen by the kernel to send the message as the receiver's address, so the correct Connector will receive a possible response.

Parameters:
msg -
Throws:
java.lang.Exception

listenOn

public void listenOn(java.lang.String bind_interface,
                     int local_port,
                     int port_range,
                     int receive_buffer_size,
                     int receiver_sock_buf_size,
                     int send_sock_buf_size,
                     int ip_ttl,
                     org.jgroups.protocols.Receiver receiver)
              throws java.io.IOException
Adds the given interface address to the list of interfaces on which the receiver mcast socket has to listen. Also creates a new Connector. Calling this method twice on the same interface will throw an exception

Parameters:
bind_interface -
local_port -
port_range -
receive_buffer_size -
Throws:
java.io.IOException

receive

public void receive(java.net.DatagramPacket packet)
Description copied from interface: org.jgroups.protocols.Receiver
Called when data has been received on a socket. When the callback returns, the buffer will be reused: therefore, if buf must be processed on a separate thread, it needs to be copied. This method might be called concurrently by multiple threads, so it has to be reentrant

Specified by:
receive in interface org.jgroups.protocols.Receiver
Parameters:
packet -

toString

public java.lang.String toString()

receivePacket

public static void receivePacket(java.net.DatagramPacket packet,
                                 java.net.DatagramSocket sock,
                                 org.jgroups.protocols.Receiver receiver)
                          throws java.io.IOException
Throws:
java.io.IOException


Copyright ? 2001,2002 www.jgroups.com . All Rights Reserved.