Package org.jgroups.protocols
Class RELAY
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.RELAY
-
@Deprecated public class RELAY extends Protocol
Deprecated.UseRELAY2
insteadSimple 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- Since:
- 2.12
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
RELAY.Receiver
Deprecated.static class
RELAY.RelayHeader
Deprecated.protected class
RELAY.RemoteViewFetcher
Deprecated.protected static class
RELAY.ViewData
Deprecated.Contains local and remote views, and UUID information
-
Field Summary
Fields Modifier and Type Field Description protected JChannel
bridge
Deprecated.The bridge between the two local clusters, usually based on a TCP configprotected java.util.function.Function<java.lang.String,JChannel>
bridge_creator
Deprecated.protected java.lang.String
bridge_name
Deprecated.protected java.lang.String
bridge_props
Deprecated.protected View
bridge_view
Deprecated.The view of the bridge cluster, usually consists of max 2 nodesprotected Address
coord
Deprecated.protected View
global_view
Deprecated.The combined view of local and remote clusterprotected long
global_view_id
Deprecated.To generate new global viewsprotected boolean
is_coord
Deprecated.protected Address
local_addr
Deprecated.protected View
local_view
Deprecated.The view of the local clusterprotected boolean
present_global_views
Deprecated.protected boolean
relay
Deprecated.protected View
remote_view
Deprecated.The view of the remote clusterprotected java.util.concurrent.Future<?>
remote_view_fetcher_future
Deprecated.protected java.lang.String
site
Deprecated.protected static byte[]
SITE_ID
Deprecated.protected TimeScheduler
timer
Deprecated.-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, log, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description RELAY()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
createBridge()
Deprecated.java.lang.Object
down(Event evt)
Deprecated.An event is to be sent down the stack.java.lang.Object
down(Message msg)
Deprecated.A message is sent down the stack.protected void
forward(byte[] buffer, int offset, int length)
Deprecated.Forwards the message across the TCP link to the other local clusterprotected void
forwardToCoord(Message msg)
Deprecated.Wraps the message annd sends it to the current coordinatorprotected View
generateGlobalView(View local_view, View remote_view)
Deprecated.protected View
generateGlobalView(View local_view, View remote_view, boolean merge)
Deprecated.java.util.function.Function<java.lang.String,JChannel>
getBridgeCreator()
Deprecated.java.lang.String
getBridgeView()
Deprecated.java.lang.String
getGlobalView()
Deprecated.java.lang.String
getLocalView()
Deprecated.java.lang.String
getRemoteView()
Deprecated.protected java.lang.Object
handleUpEvent(Message msg, RELAY.RelayHeader hdr)
Deprecated.protected void
handleView(View view)
Deprecated.void
init()
Deprecated.Called after instance has been created (null constructor) and before protocol is started.protected java.lang.Object
installView(byte[] buf, int offset, int length)
Deprecated.protected boolean
isLocal(Address dest)
Deprecated.Does the payload match the 'site' ID.protected void
sendOnLocalCluster(byte[] buf, int offset, int length)
Deprecated.protected void
sendViewOnLocalCluster(java.util.List<Address> destinations, byte[] buffer)
Deprecated.protected void
sendViewOnLocalCluster(RELAY.ViewData data, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
Deprecated.protected void
sendViewOnLocalCluster(View remote_view, View global_view, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
Deprecated.protected void
sendViewToRemote(RELAY.ViewData view_data, boolean use_seperate_thread)
Deprecated.RELAY
setBridgeCreator(java.util.function.Function<java.lang.String,JChannel> bc)
Deprecated.void
setRelay(boolean relay)
Deprecated.protected void
startRemoteViewFetcher()
Deprecated.void
stop()
Deprecated.This method is called on aJChannel.disconnect()
.protected void
stopRemoteViewFetcher()
Deprecated.java.lang.Object
up(Event evt)
Deprecated.An event was received from the protocol below.java.lang.Object
up(Message msg)
Deprecated.A single message was received.void
up(MessageBatch batch)
Deprecated.Sends up a multiple messages in aMessageBatch
.-
Methods inherited from class org.jgroups.stack.Protocol
accept, afterCreationHook, destroy, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled
-
-
-
-
Field Detail
-
site
protected java.lang.String site
Deprecated.
-
bridge_props
protected java.lang.String bridge_props
Deprecated.
-
bridge_name
protected java.lang.String bridge_name
Deprecated.
-
relay
protected boolean relay
Deprecated.
-
present_global_views
protected boolean present_global_views
Deprecated.
-
local_addr
protected Address local_addr
Deprecated.
-
is_coord
protected volatile boolean is_coord
Deprecated.
-
coord
protected volatile Address coord
Deprecated.
-
bridge
protected JChannel bridge
Deprecated.The bridge between the two local clusters, usually based on a TCP config
-
local_view
protected View local_view
Deprecated.The view of the local cluster
-
bridge_view
protected View bridge_view
Deprecated.The view of the bridge cluster, usually consists of max 2 nodes
-
remote_view
protected View remote_view
Deprecated.The view of the remote cluster
-
global_view
protected View global_view
Deprecated.The combined view of local and remote cluster
-
global_view_id
protected long global_view_id
Deprecated.To generate new global views
-
timer
protected TimeScheduler timer
Deprecated.
-
remote_view_fetcher_future
protected java.util.concurrent.Future<?> remote_view_fetcher_future
Deprecated.
-
bridge_creator
protected java.util.function.Function<java.lang.String,JChannel> bridge_creator
Deprecated.
-
SITE_ID
protected static final byte[] SITE_ID
Deprecated.
-
-
Method Detail
-
setRelay
public void setRelay(boolean relay)
Deprecated.
-
getLocalView
public java.lang.String getLocalView()
Deprecated.
-
getBridgeView
public java.lang.String getBridgeView()
Deprecated.
-
getRemoteView
public java.lang.String getRemoteView()
Deprecated.
-
getGlobalView
public java.lang.String getGlobalView()
Deprecated.
-
getBridgeCreator
public java.util.function.Function<java.lang.String,JChannel> getBridgeCreator()
Deprecated.
-
setBridgeCreator
public RELAY setBridgeCreator(java.util.function.Function<java.lang.String,JChannel> bc)
Deprecated.
-
init
public void init() throws java.lang.Exception
Deprecated.Description copied from class:Protocol
Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
-
stop
public void stop()
Deprecated.Description copied from class:Protocol
This method is called on aJChannel.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
-
down
public java.lang.Object down(Event evt)
Deprecated.Description copied from class:Protocol
An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down()
.
-
down
public java.lang.Object down(Message msg)
Deprecated.Description copied from class:Protocol
A message is sent down the stack. Protocols may examine the message and do something (e.g. add a header) with it before passing it down.
-
up
public java.lang.Object up(Event evt)
Deprecated.Description copied from class:Protocol
An event was received from the protocol below. Usually the current protocol will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally the event is either a) discarded, or b) an event is sent down the stack usingdown_prot.down()
or c) the event (or another event) is sent up the stack usingup_prot.up()
.
-
up
public java.lang.Object up(Message msg)
Deprecated.Description copied from class:Protocol
A single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up.
-
up
public void up(MessageBatch batch)
Deprecated.Description copied from class:Protocol
Sends up a multiple messages in aMessageBatch
. The sender of the batch is always the same, and so is the destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed messages, although the transport itself will create initial MessageBatches that contain only either OOB or regular messages. The default processing below sends messages up the stack individually, based on a matching criteria (callingProtocol.accept(org.jgroups.Message)
), and - if true - callsProtocol.up(org.jgroups.Event)
for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped. Subclasses should check if there are any messages destined for them (e.g. usingMessageBatch.getMatchingMessages(short,boolean)
), then possibly remove and process them and finally pass the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all encrypted messages in the batch, not remove them, and pass the batch up when done.
-
handleUpEvent
protected java.lang.Object handleUpEvent(Message msg, RELAY.RelayHeader hdr)
Deprecated.
-
handleView
protected void handleView(View view)
Deprecated.
-
installView
protected java.lang.Object installView(byte[] buf, int offset, int length)
Deprecated.
-
forward
protected void forward(byte[] buffer, int offset, int length)
Deprecated.Forwards the message across the TCP link to the other local cluster
-
forwardToCoord
protected void forwardToCoord(Message msg)
Deprecated.Wraps the message annd sends it to the current coordinator
-
sendViewToRemote
protected void sendViewToRemote(RELAY.ViewData view_data, boolean use_seperate_thread)
Deprecated.
-
generateGlobalView
protected View generateGlobalView(View local_view, View remote_view)
Deprecated.
-
generateGlobalView
protected View generateGlobalView(View local_view, View remote_view, boolean merge)
Deprecated.
-
createBridge
protected void createBridge()
Deprecated.
-
sendOnLocalCluster
protected void sendOnLocalCluster(byte[] buf, int offset, int length)
Deprecated.
-
sendViewOnLocalCluster
protected void sendViewOnLocalCluster(View remote_view, View global_view, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
Deprecated.
-
sendViewOnLocalCluster
protected void sendViewOnLocalCluster(RELAY.ViewData data, boolean use_seperate_thread, java.util.List<Address> new_mbrs)
Deprecated.
-
sendViewOnLocalCluster
protected void sendViewOnLocalCluster(java.util.List<Address> destinations, byte[] buffer)
Deprecated.
-
isLocal
protected boolean isLocal(Address dest)
Deprecated.Does the payload match the 'site' ID. Checks only unicast destinations (multicast destinations return true)
-
startRemoteViewFetcher
protected void startRemoteViewFetcher()
Deprecated.
-
stopRemoteViewFetcher
protected void stopRemoteViewFetcher()
Deprecated.
-
-