public class RELAY2 extends Protocol
Modifier and Type | Class and Description |
---|---|
static class |
RELAY2.Relay2Header |
Modifier and Type | Field and Description |
---|---|
protected boolean |
async_relay_creation |
protected boolean |
can_become_site_master |
protected boolean |
can_forward_local_cluster |
protected java.lang.String |
config |
protected boolean |
enable_address_tagging |
protected java.util.concurrent.atomic.AtomicLong |
forward_sm_time |
protected java.util.concurrent.atomic.AtomicLong |
forward_to_local_mbr
Number of messages (received from a remote Sitemaster and) delivered by the local SiteMaster to a local node
|
protected java.util.concurrent.atomic.AtomicLong |
forward_to_local_mbr_time |
protected java.util.concurrent.atomic.AtomicLong |
forward_to_site_master
Number of messages forwarded to the local SiteMaster
|
protected boolean |
forwarding_protocol_present
Whether or not FORWARD_TO_COORD is on the stack
|
protected boolean |
is_site_master |
protected Address |
local_addr |
protected java.util.concurrent.atomic.AtomicLong |
local_deliveries
Number of messages delivered locally, e.g.
|
protected java.util.concurrent.atomic.AtomicLong |
local_delivery_time
Total time (ms) for received messages that are delivered locally
|
protected int |
max_site_masters |
protected java.util.List<Address> |
members |
protected short[] |
prots_above |
protected boolean |
relay_multicasts |
protected java.util.concurrent.atomic.AtomicLong |
relayed
Number of messages relayed by the local SiteMaster to a remote SiteMaster
|
protected java.util.concurrent.atomic.AtomicLong |
relayed_time
Total time spent relaying messages from the local SiteMaster to remote SiteMasters (in ns)
|
protected Relayer |
relayer |
protected RouteStatusListener |
route_status_listener |
protected java.lang.String |
site |
protected RelayConfig.SiteConfig |
site_config |
protected SiteMasterPicker |
site_master_picker |
protected java.lang.String |
site_master_picker_impl |
protected java.util.List<Address> |
site_masters |
protected java.util.Map<java.lang.String,RelayConfig.SiteConfig> |
sites
A map containing site names (e.g.
|
protected TimeScheduler |
timer |
protected boolean |
warn_when_ftc_missing |
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
RELAY2() |
Modifier and Type | Method and Description |
---|---|
RELAY2 |
addSite(java.lang.String site_name,
RelayConfig.SiteConfig cfg) |
void |
addToRelayedTime(long delta) |
boolean |
asyncRelayCreation() |
RELAY2 |
asyncRelayCreation(boolean flag) |
boolean |
canBecomeSiteMaster() |
RELAY2 |
canBecomeSiteMaster(boolean flag) |
java.lang.String |
config() |
RELAY2 |
config(java.lang.String cfg) |
void |
configure() |
protected Message |
copy(Message msg)
Copies the message, but only the headers above the current protocol (RELAY) (or RpcDispatcher related headers)
|
protected void |
deliver(Address dest,
Address sender,
Message msg) |
protected void |
deliverLocally(SiteAddress dest,
SiteAddress sender,
Message msg) |
protected java.util.List<Address> |
determineSiteMasters(View view)
Iterates over the list of members and adds every member if the member's rank is below max_site_masters.
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
boolean |
enableAddressTagging() |
RELAY2 |
enableAddressTagging(boolean flag) |
protected void |
forwardTo(Address next_dest,
SiteAddress final_dest,
Address original_sender,
Message msg,
boolean forward_to_current_coord) |
long |
getAvgMsgsDeliveringLocally() |
long |
getAvgMsgsForwardingToLocalMbr() |
long |
getAvgMsgsForwardingToSM() |
long |
getAvgMsgsRelaying() |
JChannel |
getBridge(java.lang.String site_name)
Returns the bridge channel to a given site
|
View |
getBridgeView(java.lang.String cluster_name) |
Address |
getLocalAddress() |
long |
getNumForwardedToLocalMbr() |
long |
getNumForwardedToSiteMaster() |
long |
getNumLocalDeliveries() |
long |
getNumRelayed() |
Route |
getRoute(java.lang.String site_name)
Returns the route to a given site
|
RouteStatusListener |
getRouteStatusListener() |
java.util.List<java.lang.String> |
getSites() |
long |
getTimeDeliveringLocally() |
long |
getTimeForwardingToLocalMbr() |
long |
getTimeForwardingToSM() |
TimeScheduler |
getTimer() |
long |
getTimeRelaying() |
protected void |
handleMessage(RELAY2.Relay2Header hdr,
Message msg)
Called to handle a message received by the transport
|
protected void |
handleRelayMessage(RELAY2.Relay2Header hdr,
Message msg)
Called to handle a message received by the relayer
|
void |
handleView(View view) |
void |
incrementRelayed() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isSiteMaster() |
void |
parse(org.w3c.dom.Node node)
Called by the XML parser when subelements are found in the configuration of a protocol.
|
protected void |
parseSiteConfiguration(java.util.Map<java.lang.String,RelayConfig.SiteConfig> map)
Parses the configuration by reading the config file.
|
protected Address |
pickSiteMaster(Address sender)
Returns a site master from site_masters
|
java.lang.String |
printRoutes() |
boolean |
relayMulticasts() |
RELAY2 |
relayMulticasts(boolean flag) |
void |
resetStats() |
protected void |
route(SiteAddress dest,
SiteAddress sender,
Message msg)
Routes the message to the target destination, used by a site master (coordinator)
|
protected void |
sendSiteUnreachableTo(Address dest,
java.lang.String target_site)
Sends a SITE-UNREACHABLE message to the sender of the message.
|
protected void |
sendToBridges(Address sender,
Message msg,
java.lang.String... excluded_sites)
Sends the message via all bridges excluding the excluded_sites bridges
|
void |
setRouteStatusListener(RouteStatusListener l) |
java.lang.String |
site() |
RELAY2 |
site(java.lang.String site_name) |
RELAY2 |
siteMasterPicker(SiteMasterPicker s) |
java.util.List<java.lang.String> |
siteNames() |
protected void |
startRelayer(Relayer rel,
java.lang.String bridge_name) |
void |
stop()
This method is called on a
Channel.disconnect() . |
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, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled
protected java.lang.String site
protected java.lang.String config
protected boolean can_become_site_master
protected int max_site_masters
protected boolean enable_address_tagging
protected boolean relay_multicasts
protected boolean async_relay_creation
protected boolean warn_when_ftc_missing
protected java.lang.String site_master_picker_impl
protected final java.util.Map<java.lang.String,RelayConfig.SiteConfig> sites
protected RelayConfig.SiteConfig site_config
protected volatile boolean is_site_master
protected volatile java.util.List<Address> site_masters
protected SiteMasterPicker site_master_picker
protected volatile Relayer relayer
protected TimeScheduler timer
protected volatile Address local_addr
protected volatile java.util.List<Address> members
protected boolean forwarding_protocol_present
protected boolean can_forward_local_cluster
protected short[] prots_above
protected volatile RouteStatusListener route_status_listener
protected final java.util.concurrent.atomic.AtomicLong forward_to_site_master
protected final java.util.concurrent.atomic.AtomicLong forward_sm_time
protected final java.util.concurrent.atomic.AtomicLong relayed
protected final java.util.concurrent.atomic.AtomicLong relayed_time
protected final java.util.concurrent.atomic.AtomicLong forward_to_local_mbr
protected final java.util.concurrent.atomic.AtomicLong forward_to_local_mbr_time
protected final java.util.concurrent.atomic.AtomicLong local_deliveries
protected final java.util.concurrent.atomic.AtomicLong local_delivery_time
public RELAY2 site(java.lang.String site_name)
public RELAY2 config(java.lang.String cfg)
public RELAY2 canBecomeSiteMaster(boolean flag)
public RELAY2 enableAddressTagging(boolean flag)
public RELAY2 relayMulticasts(boolean flag)
public RELAY2 asyncRelayCreation(boolean flag)
public RELAY2 siteMasterPicker(SiteMasterPicker s)
public java.lang.String site()
public java.util.List<java.lang.String> siteNames()
public java.lang.String config()
public boolean canBecomeSiteMaster()
public boolean enableAddressTagging()
public boolean relayMulticasts()
public boolean asyncRelayCreation()
public Address getLocalAddress()
public TimeScheduler getTimer()
public void incrementRelayed()
public void addToRelayedTime(long delta)
public RouteStatusListener getRouteStatusListener()
public void setRouteStatusListener(RouteStatusListener l)
public long getNumForwardedToSiteMaster()
public long getTimeForwardingToSM()
public long getAvgMsgsForwardingToSM()
public long getNumRelayed()
public long getTimeRelaying()
public long getAvgMsgsRelaying()
public long getNumForwardedToLocalMbr()
public long getTimeForwardingToLocalMbr()
public long getAvgMsgsForwardingToLocalMbr()
public long getNumLocalDeliveries()
public long getTimeDeliveringLocally()
public long getAvgMsgsDeliveringLocally()
public boolean isSiteMaster()
public void resetStats()
resetStats
in class Protocol
public View getBridgeView(java.lang.String cluster_name)
public RELAY2 addSite(java.lang.String site_name, RelayConfig.SiteConfig cfg)
public java.util.List<java.lang.String> getSites()
public void init() throws java.lang.Exception
Protocol
public void configure() throws java.lang.Exception
java.lang.Exception
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 flushedprotected void parseSiteConfiguration(java.util.Map<java.lang.String,RelayConfig.SiteConfig> map) throws java.lang.Exception
java.lang.Exception
public void parse(org.w3c.dom.Node node) throws java.lang.Exception
Protocol
public java.lang.String printRoutes()
public JChannel getBridge(java.lang.String site_name)
site_name
- The site name, e.g. "SFO"public Route getRoute(java.lang.String site_name)
site_name
- The site name, e.g. "SFO"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()
.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()
.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 handleRelayMessage(RELAY2.Relay2Header hdr, Message msg)
protected void handleMessage(RELAY2.Relay2Header hdr, Message msg)
protected void route(SiteAddress dest, SiteAddress sender, Message msg)
dest
- sender
- the address of the sendermsg
- The messageprotected void sendToBridges(Address sender, Message msg, java.lang.String... excluded_sites)
protected void sendSiteUnreachableTo(Address dest, java.lang.String target_site)
dest
- target_site
- protected void forwardTo(Address next_dest, SiteAddress final_dest, Address original_sender, Message msg, boolean forward_to_current_coord)
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg)
protected Message copy(Message msg)
public void handleView(View view)
protected void startRelayer(Relayer rel, java.lang.String bridge_name)
protected java.util.List<Address> determineSiteMasters(View view)
Copyright © 1998-2020 Red Hat. All Rights Reserved.