Package org.jgroups.protocols.relay
Class Topology
- java.lang.Object
-
- org.jgroups.protocols.relay.Topology
-
public class Topology extends java.lang.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 ofRelayHeader.SITES_UP
orRelayHeader.SITES_DOWN
notifications. A refresh can also be triggered programmatically.
Used as a component inRELAY2
andRELAY3
.- Since:
- 5.2.15
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,View>
cache
protected boolean
global_views
protected RELAY
relay
protected 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.String
dumpSite(java.lang.String site)
boolean
globalViews()
Topology
globalViews(boolean b)
java.lang.String
print()
java.lang.String
print(java.lang.String site)
Dumps the members for a given site, or all sitesprotected void
put(java.lang.String site, View v)
Called when a response has been received.Topology
refresh()
Topology
refresh(java.lang.String site)
Refreshes the topology for a given site.Topology
refresh(java.lang.String site, boolean return_entire_cache)
Topology
removeAll(java.util.Collection<java.lang.String> sites)
Topology
setViewHandler(java.util.function.BiConsumer<java.lang.String,View> c)
Sets a view handlerjava.lang.String
toString()
-
-
-
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 theView
of 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:
toString
in 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
-
-