Package org.jgroups.protocols.relay
Class RELAY2
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.relay.RELAY
-
- org.jgroups.protocols.relay.RELAY2
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
can_forward_local_cluster
protected boolean
enable_address_tagging
protected boolean
relay_multicasts
protected ResponseCollector<java.lang.String>
topo_collector
protected long
topo_wait_time
-
Fields inherited from class org.jgroups.protocols.relay.RELAY
async_relay_creation, broadcast_route_notifications, can_become_site_master, can_become_site_master_flag, config, delay_sites_down, forward_sm_time, forward_to_local_mbr, forward_to_local_mbr_time, forward_to_site_master, is_site_master, max_site_masters, members, prots_above, relayed, relayed_time, relayer, route_status_listener, site, site_config, site_master_listener, site_master_picker, site_master_picker_impl, site_masters, site_masters_ratio, sites, suppress_log_no_route, suppress_time_no_route_errors, timer, topo, view
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description RELAY2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
_printTopology(Relayer rel)
boolean
canForwardLocalCluster()
RELAY2
canForwardLocalCluster(boolean c)
void
configure()
protected void
deliver(Address dest, Address sender, Message msg)
protected void
deliverLocally(SiteAddress dest, SiteAddress sender, Message msg)
java.lang.Object
down(Message msg)
A message is sent down the stack.boolean
enableAddressTagging()
RELAY2
enableAddressTagging(boolean flag)
protected java.lang.String
fetchTopoFromSiteMaster(Address sm)
protected void
forwardTo(Address next_dest, SiteAddress final_dest, Address original_sender, Message msg, boolean forward_to_current_coord)
long
getTopoWaitTime()
protected boolean
handleAdminMessage(RelayHeader hdr, Address sender)
Handles SITES_UP/SITES_DOWN/TOPO_REQ/TOPO_RSP messagesprotected void
handleMessage(RelayHeader hdr, Message msg)
Called to handle a message received by the transportprotected void
handleRelayMessage(Message msg)
Called to handle a message received by the relayervoid
handleView(View view)
java.lang.String
printLocalTopology()
java.lang.String
printTopology(boolean all_sites)
boolean
relayMulticasts()
RELAY2
relayMulticasts(boolean flag)
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 src, 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 bridgesprotected boolean
sendTopoReq(JChannel bridge, Address dest)
RELAY2
setTopoWaitTime(long t)
protected void
startRelayer(Relayer2 rel, java.lang.String bridge_name)
java.lang.Object
up(Message msg)
A single message was received.void
up(MessageBatch batch)
Sends up a multiple messages in aMessageBatch
.-
Methods inherited from class org.jgroups.protocols.relay.RELAY
addSite, addToRelayedTime, asyncRelayCreation, asyncRelayCreation, broadcastRouteNotifications, broadcastRouteNotifications, canBecomeSiteMaster, canBecomeSiteMaster, clearNoRouteCache, config, config, copy, delaySitesDown, delaySitesDown, determineSiteMasters, down, getAvgMsgsForwardingToLocalMbr, getAvgMsgsForwardingToSM, getAvgMsgsRelaying, getBridge, getBridgeView, getConfig, getCurrentSites, getMaxSiteMasters, getNumberOfNoRouteErrors, getNumForwardedToLocalMbr, getNumForwardedToSiteMaster, getNumRelayed, getNumRoutes, getPhysicalAddress, getRoute, getRouteStatusListener, getSite, getSiteMasterPickerImpl, getSiteMastersRatio, getSites, getTimeForwardingToLocalMbr, getTimeForwardingToSM, getTimer, getTimeRelaying, incrementRelayed, init, isLocal, isLocalSitemaster, isSiteMaster, members, notifySiteMasterListener, parse, parseSiteConfiguration, pickSiteMaster, printRoutes, printSites, resetStats, setConfig, setMaxSiteMasters, setRouteStatusListener, setSite, setSiteMasterListener, setSiteMasterPickerImpl, setSiteMastersRatio, site, site, siteMasterPicker, siteMasters, siteNames, sitesChange, stop, topo, triggerMemberUnreachableEvent, triggerSiteUnreachableEvent, up, view
-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, toString
-
-
-
-
Field Detail
-
enable_address_tagging
protected boolean enable_address_tagging
-
relay_multicasts
protected boolean relay_multicasts
-
can_forward_local_cluster
protected boolean can_forward_local_cluster
-
topo_wait_time
protected long topo_wait_time
-
topo_collector
protected final ResponseCollector<java.lang.String> topo_collector
-
-
Method Detail
-
enableAddressTagging
public RELAY2 enableAddressTagging(boolean flag)
-
relayMulticasts
public RELAY2 relayMulticasts(boolean flag)
-
enableAddressTagging
public boolean enableAddressTagging()
-
relayMulticasts
public boolean relayMulticasts()
-
canForwardLocalCluster
public boolean canForwardLocalCluster()
-
canForwardLocalCluster
public RELAY2 canForwardLocalCluster(boolean c)
-
getTopoWaitTime
public long getTopoWaitTime()
-
setTopoWaitTime
public RELAY2 setTopoWaitTime(long t)
-
configure
public void configure() throws java.lang.Exception
-
printTopology
public java.lang.String printTopology(boolean all_sites)
-
printLocalTopology
public java.lang.String printLocalTopology()
-
down
public java.lang.Object down(Message msg)
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(Message msg)
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)
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(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.iterator(Predicate)
), 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.
-
handleView
public void handleView(View view)
- Specified by:
handleView
in classRELAY
-
handleRelayMessage
protected void handleRelayMessage(Message msg)
Called to handle a message received by the relayer- Specified by:
handleRelayMessage
in classRELAY
-
handleAdminMessage
protected boolean handleAdminMessage(RelayHeader hdr, Address sender)
Handles SITES_UP/SITES_DOWN/TOPO_REQ/TOPO_RSP messages
-
handleMessage
protected void handleMessage(RelayHeader hdr, Message msg)
Called to handle a message received by the transport
-
route
protected void route(SiteAddress dest, SiteAddress sender, Message msg)
Routes the message to the target destination, used by a site master (coordinator)- Parameters:
dest
- the destination site addresssender
- the address of the sendermsg
- The message
-
sendToBridges
protected void sendToBridges(Address sender, Message msg, java.lang.String... excluded_sites)
Sends the message via all bridges excluding the excluded_sites bridges
-
sendSiteUnreachableTo
protected void sendSiteUnreachableTo(Address src, java.lang.String target_site)
Sends a SITE-UNREACHABLE message to the sender of the message. Because the sender is always local (we're the relayer), no routing needs to be done- Parameters:
src
- The node who is trying to send a message to thetarget_site
target_site
- The remote site's name.
-
forwardTo
protected void forwardTo(Address next_dest, SiteAddress final_dest, Address original_sender, Message msg, boolean forward_to_current_coord)
-
deliverLocally
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg)
-
startRelayer
protected void startRelayer(Relayer2 rel, java.lang.String bridge_name)
-
_printTopology
protected java.lang.String _printTopology(Relayer rel)
-
fetchTopoFromSiteMaster
protected java.lang.String fetchTopoFromSiteMaster(Address sm)
-
-