org.jgroups.protocols.relay
Class Relayer

java.lang.Object
  extended by org.jgroups.protocols.relay.Relayer

public class Relayer
extends java.lang.Object

Maintains bridges and routing table. Does the routing of outgoing messages and dispatches incoming messages to the right members.

A Relayer cannot be reused once it is stopped, but a new Relayer instance must be created.

Since:
3.2
Author:
Bela Ban

Nested Class Summary
protected  class Relayer.Bridge
           
 class Relayer.Route
          Includes information about the site master of the route and the channel to be used
 
Field Summary
protected  java.util.Queue<Relayer.Bridge> bridges
          The bridges which are used to connect to different sites
protected  boolean done
          Flag set when stop() is called.
protected  java.util.concurrent.ConcurrentMap<java.lang.Short,java.util.concurrent.Future<?>> down_tasks
          Map to store tasks which set the status of a site from UNKNOWN to DOWN.
protected  java.util.concurrent.ConcurrentMap<java.lang.Short,java.util.concurrent.BlockingQueue<Message>> fwd_queue
           
protected  Log log
           
protected  RELAY2 relay
           
protected  Relayer.Route[] routes
          The routing table.
protected  boolean stats
           
 
Constructor Summary
Relayer(RELAY2 relay, Log log, int num_routes)
           
 
Method Summary
 boolean done()
           
protected  View getBridgeView(java.lang.String cluster_name)
           
protected  Relayer.Route getRoute(short site)
           
protected  java.util.List<Relayer.Route> getRoutes(short... excluded_sites)
           
protected  void init(int num_routes)
           
protected static boolean isExcluded(Relayer.Route route, short... excluded_sites)
           
 java.lang.String printRoutes()
           
protected  void setRoute(short site, JChannel bridge, SiteMaster site_master, RELAY2.RouteStatus status)
           
 void start(java.util.List<RelayConfig.BridgeConfig> bridge_configs, java.lang.String bridge_name, short my_site_id)
          Creates all bridges from site_config and connects them (joining the bridge clusters)
 void stop()
          Disconnects and destroys all bridges
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

routes

protected Relayer.Route[] routes
The routing table. Site IDs are used as indices, e.g. the route for site=2 is at index 2.


bridges

protected final java.util.Queue<Relayer.Bridge> bridges
The bridges which are used to connect to different sites


log

protected final Log log

relay

protected final RELAY2 relay

done

protected volatile boolean done
Flag set when stop() is called. Since a Relayer should not be used after stop() has been called, a new instance needs to be created


stats

protected boolean stats

fwd_queue

protected final java.util.concurrent.ConcurrentMap<java.lang.Short,java.util.concurrent.BlockingQueue<Message>> fwd_queue

down_tasks

protected final java.util.concurrent.ConcurrentMap<java.lang.Short,java.util.concurrent.Future<?>> down_tasks
Map to store tasks which set the status of a site from UNKNOWN to DOWN. These are started when a site is set to UNKNOWN, but they need to be cancelled when the status goes from UNKNOWN back to UP before they kick in.

Constructor Detail

Relayer

public Relayer(RELAY2 relay,
               Log log,
               int num_routes)
Method Detail

done

public boolean done()

start

public void start(java.util.List<RelayConfig.BridgeConfig> bridge_configs,
                  java.lang.String bridge_name,
                  short my_site_id)
           throws java.lang.Throwable
Creates all bridges from site_config and connects them (joining the bridge clusters)

Parameters:
bridge_configs - A list of bridge configurations
bridge_name - The name of the local bridge channel, prefixed with '_'.
my_site_id - The ID of this site
Throws:
java.lang.Throwable

init

protected void init(int num_routes)

stop

public void stop()
Disconnects and destroys all bridges


printRoutes

public java.lang.String printRoutes()

setRoute

protected void setRoute(short site,
                        JChannel bridge,
                        SiteMaster site_master,
                        RELAY2.RouteStatus status)

getRoute

protected Relayer.Route getRoute(short site)

getRoutes

protected java.util.List<Relayer.Route> getRoutes(short... excluded_sites)

getBridgeView

protected View getBridgeView(java.lang.String cluster_name)

isExcluded

protected static boolean isExcluded(Relayer.Route route,
                                    short... excluded_sites)


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.