org.jgroups.stack

Class GossipRouter

public class GossipRouter extends 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 intDUMP
static longEXPIRY_TIME
static intGET
static longGOSSIP_REQUEST_TIMEOUT
protected Loglog
static intPORT
static intREGISTER
static longROUTING_CLIENT_REPLY_TIMEOUT
static intSHUTDOWN
static intSHUTDOWN_OK
Constructor Summary
GossipRouter()
GossipRouter(int port)
GossipRouter(int port, String bindAddressString)
GossipRouter(int port, String bindAddressString, long expiryTime)
GossipRouter(int port, String bindAddressString, long expiryTime, long gossipRequestTimeout, long routingClientReplyTimeout)
Method Summary
voidcreate()
JBoss MBean lifecycle operation.
voiddestroy()
JBoss MBean lifecycle operation.
StringdumpGossipTable()
StringdumpRoutingTable()
StringgetBindAddress()
longgetExpiryTime()
longgetGossipRequestTimeout()
intgetPort()
longgetRoutingClientReplyTimeout()
booleanisStarted()
static voidmain(String[] args)
static StringrequestTypeToString(int type)
voidsetBindAddress(String bindAddress)
voidsetExpiryTime(long expiryTime)
voidsetGossipRequestTimeout(long gossipRequestTimeout)
voidsetPort(int port)
voidsetRoutingClientReplyTimeout(long routingClientReplyTimeout)
voidstart()
JBoss MBean lifecycle operation.
voidstop()
JBoss MBean lifecycle operation.

Field Detail

DUMP

public static final int DUMP

EXPIRY_TIME

public static final long EXPIRY_TIME

GET

public static final int GET

GOSSIP_REQUEST_TIMEOUT

public static final long GOSSIP_REQUEST_TIMEOUT

log

protected final Log log

PORT

public static final int PORT

REGISTER

public static final int REGISTER

ROUTING_CLIENT_REPLY_TIMEOUT

public static final long ROUTING_CLIENT_REPLY_TIMEOUT

SHUTDOWN

public static final int SHUTDOWN

SHUTDOWN_OK

public static final int SHUTDOWN_OK

Constructor Detail

GossipRouter

public GossipRouter()

GossipRouter

public GossipRouter(int port)

GossipRouter

public GossipRouter(int port, String bindAddressString)

GossipRouter

public GossipRouter(int port, String bindAddressString, long expiryTime)

GossipRouter

public GossipRouter(int port, String bindAddressString, long expiryTime, long gossipRequestTimeout, long routingClientReplyTimeout)

Method Detail

create

public void create()
JBoss MBean lifecycle operation.

destroy

public void destroy()
JBoss MBean lifecycle operation.

dumpGossipTable

public String dumpGossipTable()

dumpRoutingTable

public String dumpRoutingTable()

getBindAddress

public String getBindAddress()

getExpiryTime

public long getExpiryTime()

getGossipRequestTimeout

public long getGossipRequestTimeout()

getPort

public int getPort()

getRoutingClientReplyTimeout

public long getRoutingClientReplyTimeout()

isStarted

public boolean isStarted()

main

public static void main(String[] args)

requestTypeToString

public static String requestTypeToString(int type)

setBindAddress

public void setBindAddress(String bindAddress)

setExpiryTime

public void setExpiryTime(long expiryTime)

setGossipRequestTimeout

public void setGossipRequestTimeout(long gossipRequestTimeout)

setPort

public void setPort(int port)

setRoutingClientReplyTimeout

public void setRoutingClientReplyTimeout(long routingClientReplyTimeout)

start

public void start()
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.

stop

public void stop()
JBoss MBean lifecycle operation. The JMX agent allways calls this method before destroy(). Close connections and frees resources.
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.