|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.stack.Protocol org.jgroups.protocols.RELAY
public class RELAY
Simple relaying protocol: RELAY is added to the top of the stack, creates a channel to a bridge cluster, and - if coordinator - relays all multicast messages via the bridge cluster to the remote cluster.
This is not a big virtual cluster, e.g. consisting of {A,B,C,X,Y,Z}, but 2 autonomous clusters {A,B,C} and {X,Y,Z}, bridged together by RELAY. For example, when B multicasts a message M, A (if it happens to be the coord) relays M to X (which happens to be the other cluster's coordinator). X then re-broadcasts M, with M.src being a ProxyUUID(X,B). This means that the sender of M in the {X,Y,Z} cluster will be X for all practical purposes, but the original sender B is also recorded, for sending back a response. See [1] and [2] for details. [1] https://jira.jboss.org/browse/JGRP-747 [2] doc/design/RELAY.txt
Nested Class Summary | |
---|---|
protected class |
RELAY.Receiver
|
static class |
RELAY.RelayHeader
|
protected class |
RELAY.RemoteViewFetcher
|
protected static class |
RELAY.ViewData
Contains local and remote views, and UUID information |
Field Summary | |
---|---|
protected JChannel |
bridge
The bridge between the two local clusters, usually based on a TCP config |
protected java.lang.String |
bridge_name
|
protected java.lang.String |
bridge_props
|
protected View |
bridge_view
The view of the bridge cluster, usually consists of max 2 nodes |
protected Address |
coord
|
protected View |
global_view
The combined view of local and remote cluster |
protected long |
global_view_id
To generate new global views |
protected boolean |
is_coord
|
protected Address |
local_addr
|
protected View |
local_view
The view of the local cluster |
protected boolean |
present_global_views
|
protected boolean |
relay
|
protected View |
remote_view
The view of the remote cluster |
protected java.util.concurrent.Future<?> |
remote_view_fetcher_future
|
protected java.lang.String |
site
|
protected TimeScheduler |
timer
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
RELAY()
|
Method Summary | |
---|---|
protected void |
createBridge()
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack. |
protected void |
forward(byte[] buffer,
int offset,
int length)
Forwards the message across the TCP link to the other local cluster |
protected void |
forwardToCoord(Message msg)
Wraps the message annd sends it to the current coordinator |
protected View |
generateGlobalView(View local_view,
View remote_view)
|
protected View |
generateGlobalView(View local_view,
View remote_view,
boolean merge)
|
java.lang.String |
getBridgeView()
|
java.lang.String |
getGlobalView()
|
java.lang.String |
getLocalView()
|
java.lang.String |
getRemoteView()
|
protected void |
handleView(View view)
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
protected java.lang.Object |
installView(byte[] buf,
int offset,
int length)
|
protected boolean |
isLocal(Address dest)
Does the payload match the 'site' ID. |
protected void |
sendOnLocalCluster(byte[] buf,
int offset,
int length)
|
protected void |
sendViewOnLocalCluster(java.util.List<Address> destinations,
byte[] buffer)
|
protected void |
sendViewOnLocalCluster(RELAY.ViewData data,
boolean use_seperate_thread,
java.util.List<Address> new_mbrs)
|
protected void |
sendViewOnLocalCluster(View remote_view,
View global_view,
boolean use_seperate_thread,
java.util.List<Address> new_mbrs)
|
protected void |
sendViewToRemote(RELAY.ViewData view_data,
boolean use_seperate_thread)
|
void |
setRelay(boolean relay)
|
protected void |
startRemoteViewFetcher()
|
void |
stop()
This method is called on a Channel.disconnect() . |
protected void |
stopRemoteViewFetcher()
|
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String site
protected java.lang.String bridge_props
protected java.lang.String bridge_name
protected boolean relay
protected boolean present_global_views
protected Address local_addr
protected volatile boolean is_coord
protected volatile Address coord
protected JChannel bridge
protected View local_view
protected View bridge_view
protected View remote_view
protected View global_view
protected long global_view_id
protected TimeScheduler timer
protected java.util.concurrent.Future<?> remote_view_fetcher_future
Constructor Detail |
---|
public RELAY()
Method Detail |
---|
public void setRelay(boolean relay)
public java.lang.String getLocalView()
public java.lang.String getBridgeView()
public java.lang.String getRemoteView()
public java.lang.String getGlobalView()
public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushed
stop
in class Protocol
public java.lang.Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.
down
in class Protocol
public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.
up
in class Protocol
protected void handleView(View view)
protected java.lang.Object installView(byte[] buf, int offset, int length)
protected void forward(byte[] buffer, int offset, int length)
protected void forwardToCoord(Message msg)
protected void sendViewToRemote(RELAY.ViewData view_data, boolean use_seperate_thread)
protected View generateGlobalView(View local_view, View remote_view)
protected View generateGlobalView(View local_view, View remote_view, boolean merge)
protected void createBridge()
protected void sendOnLocalCluster(byte[] buf, int offset, int length)
protected void sendViewOnLocalCluster(View remote_view, View global_view, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
protected void sendViewOnLocalCluster(RELAY.ViewData data, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
protected void sendViewOnLocalCluster(java.util.List<Address> destinations, byte[] buffer)
protected boolean isLocal(Address dest)
protected void startRemoteViewFetcher()
protected void stopRemoteViewFetcher()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |