Package org.jgroups.protocols.relay
Class Topology
- java.lang.Object
-
- org.jgroups.protocols.relay.Topology
-
public class Topology extends java.lang.ObjectProvides 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 ofRelayHeader.SITES_UPorRelayHeader.SITES_DOWNnotifications. A refresh can also be triggered programmatically.
Used as a component inRELAY2andRELAY3.- Since:
- 5.2.15
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,View>cacheprotected booleanglobal_viewsprotected RELAYrelayprotected java.util.function.BiConsumer<java.lang.String,View>view_handler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,View>cache()protected java.lang.StringdumpSite(java.lang.String site)booleanglobalViews()TopologyglobalViews(boolean b)java.lang.Stringprint()java.lang.Stringprint(java.lang.String site)Dumps the members for a given site, or all sitesprotected voidput(java.lang.String site, View v)Called when a response has been received.Topologyrefresh()Topologyrefresh(java.lang.String site)Refreshes the topology for a given site.Topologyrefresh(java.lang.String site, boolean return_entire_cache)TopologyremoveAll(java.util.Collection<java.lang.String> sites)TopologysetViewHandler(java.util.function.BiConsumer<java.lang.String,View> c)Sets a view handlerjava.lang.StringtoString()
-
-
-
Constructor Detail
-
Topology
public Topology(RELAY relay)
-
-
Method Detail
-
cache
public java.util.Map<java.lang.String,View> cache()
-
globalViews
public boolean globalViews()
-
globalViews
public Topology globalViews(boolean b)
-
setViewHandler
public Topology setViewHandler(java.util.function.BiConsumer<java.lang.String,View> c)
Sets a view handler- Parameters:
c- The view handler. Arguments are the site and theViewof that site)
-
refresh
public Topology refresh()
-
refresh
public Topology refresh(java.lang.String site)
Refreshes the topology for a given site.- Parameters:
site- The site. If null, all sites will be refreshed.
-
refresh
public Topology refresh(java.lang.String site, boolean return_entire_cache)
-
print
public java.lang.String print()
-
print
public java.lang.String print(java.lang.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(java.util.Collection<java.lang.String> sites)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
dumpSite
protected java.lang.String dumpSite(java.lang.String site)
-
put
protected void put(java.lang.String site, View v)Called when a response has been received. Updates the internal cache
-
-