Class RELAY2

All Implemented Interfaces:
Lifecycle

public class RELAY2 extends RELAY
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 Details

    • 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<String> topo_collector
  • Constructor Details

    • RELAY2

      public RELAY2()
  • Method Details

    • 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 Exception
      Overrides:
      configure in class RELAY
      Throws:
      Exception
    • printTopology

      public String printTopology(boolean all_sites)
    • printLocalTopology

      public String printLocalTopology()
    • down

      public 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.
      Overrides:
      down in class Protocol
    • up

      public 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.
      Overrides:
      up in class Protocol
    • up

      public void up(MessageBatch batch)
      Description copied from class: Protocol
      Sends up a multiple messages in a 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(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.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.

      Overrides:
      up in class Protocol
      Parameters:
      batch - The message batch
    • handleView

      public void handleView(View view)
      Specified by:
      handleView in class RELAY
    • handleRelayMessage

      protected void handleRelayMessage(Message msg)
      Called to handle a message received by the relayer
      Specified by:
      handleRelayMessage in class RELAY
    • 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 address
      sender - the address of the sender
      msg - The message
    • sendToBridges

      protected void sendToBridges(Address sender, Message msg, String... excluded_sites)
      Sends the message via all bridges excluding the excluded_sites bridges
    • sendSiteUnreachableTo

      protected void sendSiteUnreachableTo(Address src, 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 the target_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)
    • deliver

      protected void deliver(Address dest, Address sender, Message msg)
    • startRelayer

      protected void startRelayer(Relayer2 rel, String bridge_name)
    • _printTopology

      protected String _printTopology(Relayer rel)
    • sendTopoReq

      protected boolean sendTopoReq(JChannel bridge, Address dest)
    • fetchTopoFromSiteMaster

      protected String fetchTopoFromSiteMaster(Address sm)