Package org.jgroups.stack
Class GossipRouter
java.lang.Object
org.jgroups.stack.GossipRouter
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.
Note that a GossipRouter is also a good way of running JGroups in Amazon's EC2 environment which (as of summer 09)
doesn't support IP multicasting.
- Since:
- 2.1.1
- Author:
- Bela Ban, Vladimir Blagojevic, Ovidiu Feodorov invalid input: '<'ovidiuf@users.sourceforge.net>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final byteprotected List<GossipRouter.ConnectionTearListener> protected ThreadFactorystatic final bytestatic final bytestatic final byteprotected final Logstatic final bytestatic final bytestatic final bytestatic final intstatic final byteprotected Timer -
Constructor Summary
ConstructorsConstructorDescriptionGossipRouter(int port) GossipRouter(int port, String bindAddressString) GossipRouter(int port, String bindAddressString, boolean jmx) GossipRouter(int port, String bindAddressString, boolean jmx, long expiryTime) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voiddestroy()intlongstatic longDeprecated.longintgetPort()static longDeprecated.longbooleanbooleanbooleanstatic voidvoidsetBacklog(int backlog) voidsetBindAddress(String bindAddress) voidsetDiscardLoopbacks(boolean discard_loopbacks) voidsetExpiryTime(long expiryTime) voidsetGossipRequestTimeout(long gossipRequestTimeout) Deprecated.voidsetLingerTimeout(long linger_timeout) voidsetPort(int port) voidsetRoutingClientReplyTimeout(long routingClientReplyTimeout) Deprecated.voidsetSocketReadTimeout(long sock_read_timeout) voidstart()Lifecycle operation.voidstop()Always called before destroy().static Stringtype2String(int type)
-
Field Details
-
CONNECT
public static final byte CONNECT- See Also:
-
DISCONNECT
public static final byte DISCONNECT- See Also:
-
GOSSIP_GET
public static final byte GOSSIP_GET- See Also:
-
MESSAGE
public static final byte MESSAGE- See Also:
-
SUSPECT
public static final byte SUSPECT- See Also:
-
PING
public static final byte PING- See Also:
-
CLOSE
public static final byte CLOSE- See Also:
-
CONNECT_OK
public static final byte CONNECT_OK- See Also:
-
OP_FAIL
public static final byte OP_FAIL- See Also:
-
DISCONNECT_OK
public static final byte DISCONNECT_OK- See Also:
-
PORT
public static final int PORT- See Also:
-
connectionTearListeners
-
default_thread_factory
-
timer
-
log
-
-
Constructor Details
-
GossipRouter
public GossipRouter() -
GossipRouter
public GossipRouter(int port) -
GossipRouter
-
GossipRouter
-
GossipRouter
-
-
Method Details
-
setPort
public void setPort(int port) -
getPort
public int getPort() -
setBindAddress
-
getBindAddress
-
getBacklog
public int getBacklog() -
setBacklog
public void setBacklog(int backlog) -
setExpiryTime
public void setExpiryTime(long expiryTime) -
getExpiryTime
public long getExpiryTime() -
setGossipRequestTimeout
Deprecated. -
getGossipRequestTimeout
Deprecated. -
setRoutingClientReplyTimeout
Deprecated. -
getRoutingClientReplyTimeout
Deprecated. -
isStarted
public boolean isStarted() -
isDiscardLoopbacks
public boolean isDiscardLoopbacks() -
setDiscardLoopbacks
public void setDiscardLoopbacks(boolean discard_loopbacks) -
getLingerTimeout
public long getLingerTimeout() -
setLingerTimeout
public void setLingerTimeout(long linger_timeout) -
getSocketReadTimeout
public long getSocketReadTimeout() -
setSocketReadTimeout
public void setSocketReadTimeout(long sock_read_timeout) -
getDefaultThreadPoolThreadFactory
-
type2String
-
start
Lifecycle operation. Called after create(). When this method is called, the managed attributes have already been set.
Brings the Router into a fully functional state.- Throws:
Exception
-
stop
public void stop()Always called before destroy(). Close connections and frees resources. -
clear
public void clear() -
destroy
public void destroy() -
isRunning
public boolean isRunning() -
dumpRoutingTable
-
dumpRoutingTableDetailed
-
dumpAddresssMappings
-
main
- Throws:
Exception
-