|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.stack.Protocol org.jgroups.protocols.relay.RELAY2
public class RELAY2
Design: ./doc/design/RELAY2.txt and at https://github.com/belaban/JGroups/blob/master/doc/design/RELAY2.txt.
JIRA: https://issues.jboss.org/browse/JGRP-1433
Nested Class Summary | |
---|---|
static class |
RELAY2.Relay2Header
|
static class |
RELAY2.RouteStatus
|
Field Summary | |
---|---|
protected boolean |
async_relay_creation
|
protected boolean |
can_become_site_master
|
protected java.lang.String |
config
|
protected Address |
coord
|
protected boolean |
enable_address_tagging
|
protected long |
forward_sleep
Deprecated. |
protected java.util.concurrent.atomic.AtomicLong |
forward_sm_time
|
protected java.util.concurrent.atomic.AtomicLong |
forward_to_local_mbr
Number of messages (received from a remote Sitemaster and) delivered by the local SiteMaster to a local node |
protected java.util.concurrent.atomic.AtomicLong |
forward_to_local_mbr_time
|
protected java.util.concurrent.atomic.AtomicLong |
forward_to_site_master
Number of messages forwarded to the local SiteMaster |
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 java.util.concurrent.atomic.AtomicLong |
local_deliveries
Number of messages delivered locally, e.g. |
protected java.util.concurrent.atomic.AtomicLong |
local_delivery_time
Total time (ms) for received messages that are delivered locally |
protected int |
max_forward_attempts
|
protected short[] |
prots_above
|
protected boolean |
relay_multicasts
|
protected java.util.concurrent.atomic.AtomicLong |
relayed
Number of messages relayed by the local SiteMaster to a remote SiteMaster |
protected java.util.concurrent.atomic.AtomicLong |
relayed_time
Total time spent relaying messages from the local SiteMaster to remote SiteMasters (in ns) |
protected Relayer |
relayer
|
protected java.lang.String |
site
|
protected RelayConfig.SiteConfig |
site_config
|
protected long |
site_down_timeout
|
protected short |
site_id
|
protected java.util.Map<java.lang.String,RelayConfig.SiteConfig> |
sites
A map containing site names (e.g. |
protected TimeScheduler |
timer
|
protected boolean |
warn_when_ftc_missing
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
RELAY2()
|
Method Summary | |
---|---|
RELAY2 |
addSite(java.lang.String site_name,
RelayConfig.SiteConfig cfg)
|
void |
addToRelayedTime(long delta)
|
boolean |
asyncRelayCreation()
|
RELAY2 |
asyncRelayCreation(boolean flag)
|
boolean |
canBecomeSiteMaster()
|
RELAY2 |
canBecomeSiteMaster(boolean flag)
|
java.lang.String |
config()
|
RELAY2 |
config(java.lang.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. |
java.lang.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)
|
long |
getAvgMsgsDeliveringLocally()
|
long |
getAvgMsgsForwardingToLocalMbr()
|
long |
getAvgMsgsForwardingToSM()
|
long |
getAvgMsgsRelaying()
|
JChannel |
getBridge(java.lang.String site_name)
Returns the bridge channel to a given site |
View |
getBridgeView(java.lang.String cluster_name)
|
Address |
getLocalAddress()
|
long |
getNumForwardedToLocalMbr()
|
long |
getNumForwardedToSiteMaster()
|
long |
getNumLocalDeliveries()
|
long |
getNumRelayed()
|
Relayer.Route |
getRoute(java.lang.String site_name)
Returns the route to a given site |
long |
getTimeDeliveringLocally()
|
long |
getTimeForwardingToLocalMbr()
|
long |
getTimeForwardingToSM()
|
TimeScheduler |
getTimer()
|
long |
getTimeRelaying()
|
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 |
incrementRelayed()
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
RELAY2 |
maxForwardAttempts(int num)
Deprecated. |
protected void |
parseSiteConfiguration(java.util.Map<java.lang.String,RelayConfig.SiteConfig> map)
Parses the configuration by reading the config file. |
java.lang.String |
printRoutes()
|
boolean |
relayMulticasts()
|
RELAY2 |
relayMulticasts(boolean flag)
|
void |
resetStats()
|
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)
Sends a SITE-UNREACHABLE message to the sender of the message. |
protected void |
sendToBridges(Address sender,
Message msg,
short... excluded_sites)
Sends the message via all bridges excluding the excluded_sites bridges |
java.lang.String |
site()
|
RELAY2 |
site(java.lang.String site_name)
|
long |
siteDownTimeout()
|
RELAY2 |
siteDownTimeout(long timeout)
|
protected void |
startRelayer(Relayer rel,
java.lang.String bridge_name)
|
void |
stop()
This method is called on a Channel.disconnect() . |
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String site
protected java.lang.String config
protected boolean can_become_site_master
protected boolean enable_address_tagging
protected boolean relay_multicasts
protected int max_forward_attempts
@Deprecated protected long forward_sleep
protected int fwd_queue_max_size
protected long site_down_timeout
protected boolean async_relay_creation
protected boolean warn_when_ftc_missing
protected short site_id
protected final java.util.Map<java.lang.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 short[] prots_above
protected final java.util.concurrent.atomic.AtomicLong forward_to_site_master
protected final java.util.concurrent.atomic.AtomicLong forward_sm_time
protected final java.util.concurrent.atomic.AtomicLong relayed
protected final java.util.concurrent.atomic.AtomicLong relayed_time
protected final java.util.concurrent.atomic.AtomicLong forward_to_local_mbr
protected final java.util.concurrent.atomic.AtomicLong forward_to_local_mbr_time
protected final java.util.concurrent.atomic.AtomicLong local_deliveries
protected final java.util.concurrent.atomic.AtomicLong local_delivery_time
Constructor Detail |
---|
public RELAY2()
Method Detail |
---|
public RELAY2 site(java.lang.String site_name)
public RELAY2 config(java.lang.String cfg)
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 java.lang.String site()
public java.lang.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 void incrementRelayed()
public void addToRelayedTime(long delta)
public long getNumForwardedToSiteMaster()
public long getTimeForwardingToSM()
public long getAvgMsgsForwardingToSM()
public long getNumRelayed()
public long getTimeRelaying()
public long getAvgMsgsRelaying()
public long getNumForwardedToLocalMbr()
public long getTimeForwardingToLocalMbr()
public long getAvgMsgsForwardingToLocalMbr()
public long getNumLocalDeliveries()
public long getTimeDeliveringLocally()
public long getAvgMsgsDeliveringLocally()
public void resetStats()
resetStats
in class Protocol
public View getBridgeView(java.lang.String cluster_name)
public RELAY2 addSite(java.lang.String site_name, RelayConfig.SiteConfig cfg)
public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic 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 flushed
stop
in class Protocol
protected void parseSiteConfiguration(java.util.Map<java.lang.String,RelayConfig.SiteConfig> map) throws java.lang.Exception
java.lang.Exception
public java.lang.String printRoutes()
public JChannel getBridge(java.lang.String site_name)
site_name
- The site name, e.g. "SFO"
public Relayer.Route getRoute(java.lang.String site_name)
site_name
- The site name, e.g. "SFO"
public java.lang.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()
.
down
in class Protocol
public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.
up
in class Protocol
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
- sender
- the address of the sendermsg
- The messageprotected void sendToBridges(Address sender, Message msg, short... excluded_sites)
protected void sendSiteUnreachableTo(Address dest, short target_site)
dest
- 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 void deliver(Address dest, Address sender, Message msg)
protected Message copy(Message msg)
protected void handleView(View view)
protected void startRelayer(Relayer rel, java.lang.String bridge_name)
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 returned
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |