org.jgroups.protocols.relay
public class RELAY2 extends Protocol
Modifier and Type | Class and Description |
---|---|
static class |
RELAY2.Relay2Header |
static class |
RELAY2.RouteStatus |
Modifier and Type | Field and Description |
---|---|
protected boolean |
async_relay_creation |
protected boolean |
can_become_site_master |
protected boolean |
can_forward_local_cluster |
protected String |
config |
protected Address |
coord |
protected boolean |
enable_address_tagging |
protected long |
forward_sleep |
protected boolean |
forwarding_protocol_present
Whether or not FORWARD_TO_COORD is on the stack
|
protected int |
fwd_queue_max_size |
protected boolean |
is_coord |
protected Address |
local_addr |
protected int |
max_forward_attempts |
protected List<Address> |
members |
protected short[] |
prots_above |
protected boolean |
relay_multicasts |
protected Relayer |
relayer |
protected String |
site |
protected RelayConfig.SiteConfig |
site_config |
protected long |
site_down_timeout |
protected short |
site_id |
protected Map<String,RelayConfig.SiteConfig> |
sites
A map containing site names (e.g.
|
protected TimeScheduler |
timer |
Constructor and Description |
---|
RELAY2() |
Modifier and Type | Method and Description |
---|---|
RELAY2 |
addSite(String site_name,
RelayConfig.SiteConfig cfg) |
boolean |
asyncRelayCreation() |
RELAY2 |
asyncRelayCreation(boolean flag) |
boolean |
canBecomeSiteMaster() |
RELAY2 |
canBecomeSiteMaster(boolean flag) |
String |
config() |
RELAY2 |
config(String cfg) |
protected Message |
copy(Message msg)
Copies the message, but only the headers above the current protocol (RELAY) (or RpcDispatcher related headers)
|
protected void |
deliver(Address dest,
Address sender,
Message msg) |
protected void |
deliverLocally(SiteAddress dest,
SiteAddress sender,
Message msg) |
protected static Address |
determineSiteMaster(View view)
Gets the site master from view.
|
Object |
down(Event evt)
An event is to be sent down the stack.
|
boolean |
enableAddressTagging() |
RELAY2 |
enableAddressTagging(boolean flag) |
int |
forwardQueueMaxSize() |
RELAY2 |
forwardQueueMaxSize(int size) |
RELAY2 |
forwardSleep(long time)
Deprecated.
|
protected void |
forwardTo(Address next_dest,
SiteAddress final_dest,
Address original_sender,
Message msg,
boolean forward_to_current_coord) |
JChannel |
getBridge(String site_name)
Returns the bridge channel to a given site
|
View |
getBridgeView(String cluster_name) |
Address |
getLocalAddress() |
Relayer.Route |
getRoute(String site_name)
Returns the route to a given site
|
TimeScheduler |
getTimer() |
protected void |
handleMessage(RELAY2.Relay2Header hdr,
Message msg)
Called to handle a message received by the transport
|
protected void |
handleRelayMessage(RELAY2.Relay2Header hdr,
Message msg)
Called to handle a message received by the relayer
|
protected void |
handleView(View view) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
RELAY2 |
maxForwardAttempts(int num)
Deprecated.
|
protected void |
parseSiteConfiguration(Map<String,RelayConfig.SiteConfig> map)
Parses the configuration by reading the config file.
|
String |
printRoutes() |
boolean |
relayMulticasts() |
RELAY2 |
relayMulticasts(boolean flag) |
protected void |
route(SiteAddress dest,
SiteAddress sender,
Message msg)
Routes the message to the target destination, used by a site master (coordinator)
|
protected void |
sendSiteUnreachableTo(Address dest,
short target_site) |
protected void |
sendToBridges(Address sender,
Message msg,
short... excluded_sites)
Sends the message via all bridges excluding the excluded_sites bridges
|
String |
site() |
RELAY2 |
site(String site_name) |
long |
siteDownTimeout() |
RELAY2 |
siteDownTimeout(long timeout) |
protected void |
startRelayer(Relayer rel,
String bridge_name) |
void |
stop()
This method is called on a
Channel.disconnect() . |
Object |
up(Event evt)
An event was received from the layer below.
|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled
protected String site
protected String config
protected boolean can_become_site_master
protected boolean enable_address_tagging
protected boolean relay_multicasts
protected int max_forward_attempts
protected long forward_sleep
protected int fwd_queue_max_size
protected long site_down_timeout
protected boolean async_relay_creation
protected short site_id
protected final Map<String,RelayConfig.SiteConfig> sites
protected RelayConfig.SiteConfig site_config
protected volatile boolean is_coord
protected volatile Address coord
protected volatile Relayer relayer
protected TimeScheduler timer
protected volatile Address local_addr
protected boolean forwarding_protocol_present
protected boolean can_forward_local_cluster
protected short[] prots_above
public RELAY2 canBecomeSiteMaster(boolean flag)
public RELAY2 enableAddressTagging(boolean flag)
public RELAY2 relayMulticasts(boolean flag)
@Deprecated public RELAY2 maxForwardAttempts(int num)
@Deprecated public RELAY2 forwardSleep(long time)
public RELAY2 forwardQueueMaxSize(int size)
public RELAY2 siteDownTimeout(long timeout)
public RELAY2 asyncRelayCreation(boolean flag)
public String site()
public String config()
public boolean canBecomeSiteMaster()
public boolean enableAddressTagging()
public boolean relayMulticasts()
public int forwardQueueMaxSize()
public long siteDownTimeout()
public boolean asyncRelayCreation()
public Address getLocalAddress()
public TimeScheduler getTimer()
public RELAY2 addSite(String site_name, RelayConfig.SiteConfig cfg)
public void init() throws Exception
Protocol
public void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedprotected void parseSiteConfiguration(Map<String,RelayConfig.SiteConfig> map) throws Exception
Exception
public String printRoutes()
public JChannel getBridge(String site_name)
site_name
- The site name, e.g. "SFO"public Relayer.Route getRoute(String site_name)
site_name
- The site name, e.g. "SFO"public Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.public Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.protected void handleRelayMessage(RELAY2.Relay2Header hdr, Message msg)
protected void handleMessage(RELAY2.Relay2Header hdr, Message msg)
protected void route(SiteAddress dest, SiteAddress sender, Message msg)
dest
- buf
- protected void sendToBridges(Address sender, Message msg, short... excluded_sites)
protected void sendSiteUnreachableTo(Address dest, short target_site)
protected void forwardTo(Address next_dest, SiteAddress final_dest, Address original_sender, Message msg, boolean forward_to_current_coord)
protected void deliverLocally(SiteAddress dest, SiteAddress sender, Message msg)
protected Message copy(Message msg)
protected void handleView(View view)
protected static Address determineSiteMaster(View view)
CanBeSiteMaster
or CanBeSiteMasterTopology
and its can_become_site_master field is false. If no valid member is found
(e.g. all members have can_become_site_master set to false, then the first member will be returnedCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.