public class RELAY extends Protocol
Modifier and Type | Class and Description |
---|---|
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
|
Modifier and Type | Field and Description |
---|---|
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 static byte[] |
SITE_ID |
protected TimeScheduler |
timer |
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
RELAY() |
Modifier and Type | Method and Description |
---|---|
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 java.lang.Object |
handleUpEvent(Message msg,
RELAY.RelayHeader hdr) |
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.
|
void |
up(MessageBatch batch)
Sends up a multiple messages in a
MessageBatch . |
accept, afterCreationHook, destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled
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
protected static final byte[] SITE_ID
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
public 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 flushedpublic 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()
.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()
.protected java.lang.Object handleUpEvent(Message msg, RELAY.RelayHeader hdr)
public void up(MessageBatch batch)
Protocol
MessageBatch
. 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
(calling Protocol.accept(org.jgroups.Message)
), and - if true - calls Protocol.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. using
MessageBatch.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.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, 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()
Copyright © 1998-2020 Red Hat. All Rights Reserved.