Class Topology

java.lang.Object
org.jgroups.protocols.relay.Topology

public class Topology extends Object
Provides a cache of all sites and their members (addresses, IP addresses, site masters etc) in a network of autonomous sites. The cache is an approximation, and is refreshed on reception of RelayHeader.SITES_UP or RelayHeader.SITES_DOWN notifications. A refresh can also be triggered programmatically.

Used as a component in RELAY2 and RELAY3.

Since:
5.2.15
  • Field Details

    • relay

      protected final RELAY relay
    • cache

      protected final Map<String,View> cache
    • view_handler

      protected BiConsumer<String,View> view_handler
    • global_views

      protected boolean global_views
  • Constructor Details

    • Topology

      public Topology(RELAY relay)
  • Method Details

    • cache

      public Map<String,View> cache()
    • globalViews

      public boolean globalViews()
    • globalViews

      public Topology globalViews(boolean b)
    • setViewHandler

      public Topology setViewHandler(BiConsumer<String,View> c)
      Sets a view handler
      Parameters:
      c - The view handler. Arguments are the site and the View of that site)
    • refresh

      public Topology refresh()
    • refresh

      public Topology refresh(String site)
      Refreshes the topology for a given site.
      Parameters:
      site - The site. If null, all sites will be refreshed.
    • refresh

      public Topology refresh(String site, boolean return_entire_cache)
    • print

      public String print()
    • print

      public String print(String site)
      Dumps the members for a given site, or all sites
      Parameters:
      site - The site name. Dumps all sites if null
      Returns:
      A string of all sites and their members
    • removeAll

      public Topology removeAll(Collection<String> sites)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • dumpSite

      protected String dumpSite(String site)
    • put

      protected void put(String site, View v)
      Called when a response has been received. Updates the internal cache