Class GossipRouter

java.lang.Object
org.jgroups.stack.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.

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>
  • Field Details

  • Constructor Details

    • GossipRouter

      public GossipRouter()
    • GossipRouter

      public GossipRouter(int port)
    • GossipRouter

      public GossipRouter(int port, String bindAddressString)
    • GossipRouter

      public GossipRouter(int port, String bindAddressString, boolean jmx)
    • GossipRouter

      public GossipRouter(int port, String bindAddressString, boolean jmx, long expiryTime)
  • Method Details

    • setPort

      public void setPort(int port)
    • getPort

      public int getPort()
    • setBindAddress

      public void setBindAddress(String bindAddress)
    • getBindAddress

      public String getBindAddress()
    • getBacklog

      public int getBacklog()
    • setBacklog

      public void setBacklog(int backlog)
    • setExpiryTime

      public void setExpiryTime(long expiryTime)
    • getExpiryTime

      public long getExpiryTime()
    • setGossipRequestTimeout

      @Deprecated public void setGossipRequestTimeout(long gossipRequestTimeout)
      Deprecated.
    • getGossipRequestTimeout

      @Deprecated public static long getGossipRequestTimeout()
      Deprecated.
    • setRoutingClientReplyTimeout

      @Deprecated public void setRoutingClientReplyTimeout(long routingClientReplyTimeout)
      Deprecated.
    • getRoutingClientReplyTimeout

      @Deprecated public static long 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

      public ThreadFactory getDefaultThreadPoolThreadFactory()
    • type2String

      public static String type2String(int type)
    • start

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

      public String dumpRoutingTable()
    • dumpRoutingTableDetailed

      public String dumpRoutingTableDetailed()
    • dumpAddresssMappings

      public String dumpAddresssMappings()
    • main

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