Package org.jgroups.protocols.relay
Class Relayer
- java.lang.Object
-
- 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
Nested Classes Modifier and Type Class Description protected class
Relayer.Bridge
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Queue<Relayer.Bridge>
bridges
The bridges which are used to connect to different sitesprotected boolean
done
Flag set when stop() is called.protected Log
log
protected RELAY2
relay
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<Route>>
routes
The routing table.protected boolean
stats
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
done()
protected View
getBridgeView(java.lang.String cluster_name)
protected Route
getRoute(java.lang.String site)
protected Route
getRoute(java.lang.String site, Address sender)
protected java.util.List<Route>
getRoutes(java.lang.String... excluded_sites)
protected java.util.List<java.lang.String>
getSiteNames()
protected static boolean
isExcluded(Route route, java.lang.String... excluded_sites)
java.lang.String
printRoutes()
void
start(java.util.List<RelayConfig.BridgeConfig> bridge_configs, java.lang.String bridge_name, java.lang.String my_site_id)
Creates all bridges from site_config and connects them (joining the bridge clusters)void
stop()
Disconnects and destroys all bridges
-
-
-
Field Detail
-
routes
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<Route>> routes
The routing table. Site IDs are the keys (e.g. "sfo", and list of routes are the values
-
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
-
-
Method Detail
-
done
public boolean done()
-
start
public void start(java.util.List<RelayConfig.BridgeConfig> bridge_configs, java.lang.String bridge_name, java.lang.String 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 configurationsbridge_name
- The name of the local bridge channel, prefixed with '_'.my_site_id
- The ID of this site- Throws:
java.lang.Throwable
-
stop
public void stop()
Disconnects and destroys all bridges
-
printRoutes
public java.lang.String printRoutes()
-
getRoute
protected Route getRoute(java.lang.String site)
-
getSiteNames
protected java.util.List<java.lang.String> getSiteNames()
-
getRoutes
protected java.util.List<Route> getRoutes(java.lang.String... excluded_sites)
-
getBridgeView
protected View getBridgeView(java.lang.String cluster_name)
-
isExcluded
protected static boolean isExcluded(Route route, java.lang.String... excluded_sites)
-
-