org.jgroups.stack
Class GossipRouter

java.lang.Object
  extended by org.jgroups.stack.GossipRouter

public class GossipRouter
extends java.lang.Object

Router for TCP based group comunication (using layer TCP instead of UDP). Instead of the TCP layer sending packets point-to-point to each other member, it sends the packet to the router which - depending on the target address - multicasts or unicasts it to the group / or single member.

This class is especially interesting for applets which cannot directly make connections (neither UDP nor TCP) to a host different from the one they were loaded from. Therefore, an applet would create a normal channel plus protocol stack, but the bottom layer would have to be the TCP layer which sends all packets point-to-point (over a TCP connection) to the router, which in turn forwards them to their end location(s) (also over TCP). A centralized router would therefore have to be running on the host the applet was loaded from.

An alternative for running JGroups in an applet (IP multicast is not allows in applets as of 1.2), is to use point-to-point UDP communication via the gossip server. However, then the appplet has to be signed which involves additional administrative effort on the part of the user.

Since 2.1.1 the GossipRouter is also able to answer Gossip requests. Instead of running different Router and GossipServer processes, is enough just to run a single GossipRouter. This should simplify the administration of a JG realm that has needs gossip and routing services.

Since:
2.1.1
Author:
Bela Ban, Ovidiu Feodorov

Field Summary
static int DUMP
           
static long EXPIRY_TIME
           
static int GET
           
static long GOSSIP_REQUEST_TIMEOUT
           
protected  org.apache.commons.logging.Log log
           
static int PORT
           
static int REGISTER
           
static long ROUTING_CLIENT_REPLY_TIMEOUT
           
static int SHUTDOWN
           
static int SHUTDOWN_OK
           
 
Constructor Summary
GossipRouter()
           
GossipRouter(int port)
           
GossipRouter(int port, java.lang.String bindAddressString)
           
GossipRouter(int port, java.lang.String bindAddressString, long expiryTime)
           
GossipRouter(int port, java.lang.String bindAddressString, long expiryTime, long gossipRequestTimeout, long routingClientReplyTimeout)
           
 
Method Summary
 void create()
          JBoss MBean lifecycle operation.
 void destroy()
          JBoss MBean lifecycle operation.
 java.lang.String dumpGossipTable()
           
 java.lang.String dumpRoutingTable()
           
 java.lang.String getBindAddress()
           
 long getExpiryTime()
           
 long getGossipRequestTimeout()
           
 int getPort()
           
 long getRoutingClientReplyTimeout()
           
 boolean isStarted()
           
static void main(java.lang.String[] args)
           
static java.lang.String requestTypeToString(int type)
           
 void setBindAddress(java.lang.String bindAddress)
           
 void setExpiryTime(long expiryTime)
           
 void setGossipRequestTimeout(long gossipRequestTimeout)
           
 void setPort(int port)
           
 void setRoutingClientReplyTimeout(long routingClientReplyTimeout)
           
 void start()
          JBoss MBean lifecycle operation.
 void stop()
          JBoss MBean lifecycle operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET

public static final int GET
See Also:
Constant Field Values

REGISTER

public static final int REGISTER
See Also:
Constant Field Values

DUMP

public static final int DUMP
See Also:
Constant Field Values

SHUTDOWN

public static final int SHUTDOWN
See Also:
Constant Field Values

SHUTDOWN_OK

public static final int SHUTDOWN_OK
See Also:
Constant Field Values

PORT

public static final int PORT
See Also:
Constant Field Values

EXPIRY_TIME

public static final long EXPIRY_TIME
See Also:
Constant Field Values

GOSSIP_REQUEST_TIMEOUT

public static final long GOSSIP_REQUEST_TIMEOUT
See Also:
Constant Field Values

ROUTING_CLIENT_REPLY_TIMEOUT

public static final long ROUTING_CLIENT_REPLY_TIMEOUT
See Also:
Constant Field Values

log

protected final org.apache.commons.logging.Log log
Constructor Detail

GossipRouter

public GossipRouter()

GossipRouter

public GossipRouter(int port)

GossipRouter

public GossipRouter(int port,
                    java.lang.String bindAddressString)

GossipRouter

public GossipRouter(int port,
                    java.lang.String bindAddressString,
                    long expiryTime)

GossipRouter

public GossipRouter(int port,
                    java.lang.String bindAddressString,
                    long expiryTime,
                    long gossipRequestTimeout,
                    long routingClientReplyTimeout)
Method Detail

setPort

public void setPort(int port)

getPort

public int getPort()

setBindAddress

public void setBindAddress(java.lang.String bindAddress)

getBindAddress

public java.lang.String getBindAddress()

setExpiryTime

public void setExpiryTime(long expiryTime)

getExpiryTime

public long getExpiryTime()

setGossipRequestTimeout

public void setGossipRequestTimeout(long gossipRequestTimeout)

getGossipRequestTimeout

public long getGossipRequestTimeout()

setRoutingClientReplyTimeout

public void setRoutingClientReplyTimeout(long routingClientReplyTimeout)

getRoutingClientReplyTimeout

public long getRoutingClientReplyTimeout()

isStarted

public boolean isStarted()

create

public void create()
            throws java.lang.Exception
JBoss MBean lifecycle operation.

Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
JBoss MBean lifecycle operation. Called after create(). When this method is called, the managed attributes have already been set.
Brings the Router in fully functional state.

Throws:
java.lang.Exception

stop

public void stop()
JBoss MBean lifecycle operation. The JMX agent allways calls this method before destroy(). Close connections and frees resources.


destroy

public void destroy()
JBoss MBean lifecycle operation.


dumpRoutingTable

public java.lang.String dumpRoutingTable()

dumpGossipTable

public java.lang.String dumpGossipTable()

requestTypeToString

public static java.lang.String requestTypeToString(int type)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright ? 1998-2005 Bela Ban. All Rights Reserved.