Class RELAY3
- All Implemented Interfaces:
Lifecycle
Design: ./doc/design/RELAY2.txt and at https://github.com/belaban/JGroups/blob/master/doc/design/RELAY2.txt.
JIRA: https://issues.redhat.com/browse/JGRP-1433
- Since:
- 3.2
-
Field Summary
FieldsFields 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, viewFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected AddresscheckLocalAddress(Address dest) voidlongdelaySiteUnreachableEvents(long t) protected ObjectSends the message to a local destination.protected Objectvoiddestroy()This method is called on aJChannel.close().A message is sent down the stack.protected booleanhandleAdminMessage(RelayHeader hdr, Message msg) Handles SITES_UP/SITES_DOWN/TOPO_REQ/TOPO_RSP messagesprotected <T> ObjecthandleRelayerStarted(Relayer r, long start, T ignored, Throwable t) protected voidCalled to handle a message received from a different site (via a bridge channel)voidhandleView(View view) voidinit()Called after a protocol has been created and before the protocol is started.protected booleanmustBeRouted(Message msg) Determines if a message should be routed.protected ObjectSends a message up the stack.printTopology(boolean all_sites) protected ObjectThis method has all the routing logic, for both site masters and regular membersprotected Objectroute(Message msg, Collection<String> sites) Sends a message to the given sites, or all sites (excluding the local site)protected Objectprotected booleansameSite(SiteAddress addr) protected voidsendMemberUnreachableTo(Address dest, Address member) Sends a MBR-UNREACHABLE message to the sender of a unicast messageprotected voidprotected voidsendResponseTo(Address dest, boolean all_sites) Returns information about all members of all sites, or only the local members of a given siteprotected voidsendSiteUnreachableTo(Address dest, String target_site) Sends a SITE-UNREACHABLE message to the sender of the message.protected ObjectsendToLocalSiteMaster(Address sender, Message msg) protected CompletableFuture<Relayer> startRelayer(Relayer3 rel, String bridge_name) protected voidprotected voidA single message was received.voidup(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, 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, up, viewMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, 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 Details
-
site_status
-
delay_site_unreachable_events
protected long delay_site_unreachable_events -
site_unreachable_delayer
-
unicast
-
-
Constructor Details
-
RELAY3
public RELAY3()
-
-
Method Details
-
siteStatus
-
delaySiteUnreachableEvents
public long delaySiteUnreachableEvents() -
delaySiteUnreachableEvents
-
configure
-
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
destroy
public void destroy()Description copied from class:ProtocolThis method is called on aJChannel.close(). Does some cleanup; after the call, the VM will terminate -
printTopology
-
printLocalTopology
-
down
Description copied from class:ProtocolA 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
Description copied from class:ProtocolA single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up. -
up
Description copied from class:ProtocolSends 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 (calling
Protocol.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. using
MessageBatch.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. -
sendResponseTo
Returns information about all members of all sites, or only the local members of a given site- Parameters:
dest- The address to which to send the responseall_sites- When true, return information about all sites (1 msg/site), otherwise only about this site
-
sendResponsesForAllSites
-
handleView
- Specified by:
handleViewin classRELAY
-
handleRelayerStarted
-
handleRelayMessage
Called to handle a message received from a different site (via a bridge channel)- Specified by:
handleRelayMessagein classRELAY
-
handleAdminMessage
Handles SITES_UP/SITES_DOWN/TOPO_REQ/TOPO_RSP messages -
triggerSiteUnreachableEvent
- Overrides:
triggerSiteUnreachableEventin classRELAY
-
_triggerSiteUnreachableEvent
-
triggerMemberUnreachableEvent
- Overrides:
triggerMemberUnreachableEventin classRELAY
-
routeThen
-
process
This method has all the routing logic, for both site masters and regular members -
mustBeRouted
Determines if a message should be routed. If NO_RELAY is set, then the message won't be routed. If we have multiple site masters, and this site master is picked to route the message, then return true, else return false. JIRA: https://issues.redhat.com/browse/JGRP-2696 -
route
Sends a message to the given sites, or all sites (excluding the local site)- Parameters:
msg- The message to be sentsites- The sites to send the message to. If null, msg will be sent to all sites listed in the routing table, excepting the local site
-
deliver
Sends the message to a local destination.- Parameters:
next_dest- The destination. If null, the message will be delivered to all members of the local cluster. In this case, flagMessage.Flag.NO_RELAYwill be set, so that the resulting multicast is not forwarded to other sites.msg- The message to deliver
-
deliver
-
sendToLocalSiteMaster
-
passUp
Sends a message up the stack. If there's a header, msg.dest is set to the header's final destination and msg.src to te header's original sender- Parameters:
msg- The message to be sent up
-
checkLocalAddress
-
sameSite
-
sendSiteUnreachableTo
Sends a SITE-UNREACHABLE message to the sender of the message.- Parameters:
dest- The node who is trying to send a message to thetarget_sitetarget_site- The remote site's name.
-
sendMemberUnreachableTo
Sends a MBR-UNREACHABLE message to the sender of a unicast message- Parameters:
dest- The node who original sent the unicast message. Must never be null
-
startRelayer
-