|
|||||||||
| Home >> All >> org >> jgroups >> protocols >> [ pbcast overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jgroups.protocols.pbcast
Class STABLE

java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.pbcast.STABLE
- public class STABLE
- extends org.jgroups.stack.Protocol
Computes the broadcast messages that are stable; i.e., have been received by all members. Sends STABLE events up the stack when this is the case. This allows NAKACK to garbage collect messages that have been seen by all members.
Works as follows: periodically we mcast our highest seqnos (seen for each member) to the group. A stability vector, which maintains the highest seqno for each member and initially contains no data, is updated when such a message is received. The entry for a member P is computed set to min(entry[P], digest[P]). When messages from all members have been received, a stability message is mcast, which causes all members to send a STABLE event up the stack (triggering garbage collection in the NAKACK layer).
The stable task now terminates after max_num_gossips if no messages or view changes have been sent or received
in the meantime. It will resume when messages are received. This effectively suspends sending superfluous
STABLE messages in the face of no activity.
New: when max_bytes is exceeded (unless disabled by setting it to 0),
a STABLE task will be started (unless it is already running).
| Nested Class Summary | |
private class |
STABLE.ResumeTask
|
private class |
STABLE.StabilitySendTask
Multicasts a STABILITY message. |
static class |
STABLE.StableHeader
|
private class |
STABLE.StableTask
Mcast periodic STABLE message. |
| Field Summary | |
(package private) long |
desired_avg_gossip
Sends a STABLE gossip every 20 seconds on average. |
(package private) Digest |
digest
|
(package private) java.util.Vector |
heard_from
|
(package private) boolean |
initialized
|
(package private) Digest |
latest_local_digest
|
(package private) org.jgroups.Address |
local_addr
|
(package private) long |
max_bytes
Total amount of bytes from incoming messages (default = 0 = disabled). |
(package private) java.util.Vector |
mbrs
|
(package private) static java.lang.String |
name
|
(package private) long |
num_bytes_received
The total number of bytes received from unicast and multicast messages |
(package private) int |
num_gossips
Number of gossip messages |
(package private) STABLE.ResumeTask |
resume_task
|
(package private) java.lang.Object |
resume_task_mutex
|
(package private) long |
stability_delay
delay before we send STABILITY msg (give others a change to send first). |
(package private) java.lang.Object |
stability_mutex
|
(package private) STABLE.StabilitySendTask |
stability_task
|
(package private) STABLE.StableTask |
stable_task
|
(package private) java.lang.Object |
stable_task_mutex
|
(package private) boolean |
suspended
When true, don't take part in garbage collection protocol: neither send STABLE messages nor handle STABILITY messages |
(package private) org.jgroups.util.TimeScheduler |
timer
|
| Fields inherited from class org.jgroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn |
| Constructor Summary | |
STABLE()
|
|
| Method Summary | |
private void |
adjustSenders(Digest d,
java.util.Vector members)
Digest and members are guaranteed to be non-null |
private void |
clearDigest()
|
void |
down(org.jgroups.Event evt)
An event is to be sent down the stack. |
long |
getDesiredAverageGossip()
|
long |
getMaxBytes()
|
java.lang.String |
getName()
|
int |
getNumberOfGossipMessages()
|
(package private) void |
handleStabilityMessage(Digest d,
org.jgroups.Address sender)
|
private void |
handleStableMessage(org.jgroups.Address sender,
Digest d)
Digest d contains (a) the highest seqnos deliverable for each sender and (b) the highest seqnos seen for each member. |
private void |
handleViewChange(org.jgroups.View v)
|
private boolean |
removeFromHeardFromList(org.jgroups.Address mbr)
Removes mbr from heard_from and returns true if this was the last member, otherwise false. |
java.util.Vector |
requiredDownServices()
List of events that are required to be answered by some layer below. |
private void |
resetDigest(java.util.Vector new_members)
|
void |
resetStats()
|
private void |
resume()
|
void |
runMessageGarbageCollection()
|
(package private) void |
sendStabilityMessage(Digest tmp)
Schedules a stability message to be mcast after a random number of milliseconds (range 1-5 secs). |
private void |
sendStableMessage(Digest d)
Bcasts a STABLE message of the current digest to all members. |
void |
setDesiredAverageGossip(long gossip_interval)
|
void |
setMaxBytes(long max_bytes)
|
boolean |
setProperties(java.util.Properties props)
Configures the protocol initially. |
void |
start()
This method is called on a Channel.connect(String)> Channel.connect(String) 55 . |
(package private) void |
startResumeTask(long max_suspend_time)
|
(package private) void |
startStabilityTask(Digest d,
long delay)
|
(package private) void |
startStableTask()
|
void |
stop()
This method is called on a Channel.disconnect()> Channel.disconnect() 55 . |
(package private) void |
stopResumeTask()
|
(package private) void |
stopStabilityTask()
|
(package private) void |
stopStableTask()
|
private void |
suspend(long timeout)
|
void |
up(org.jgroups.Event evt)
An event was received from the layer below. |
private boolean |
updateLocalDigest(Digest d,
org.jgroups.Address sender)
Update my own digest from a digest received by somebody else. |
| Methods inherited from class org.jgroups.stack.Protocol |
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, startDownHandler, startUpHandler, statsEnabled, stopInternal, upThreadEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
local_addr
org.jgroups.Address local_addr
mbrs
final java.util.Vector mbrs
digest
final Digest digest
latest_local_digest
final Digest latest_local_digest
heard_from
final java.util.Vector heard_from
desired_avg_gossip
long desired_avg_gossip
- Sends a STABLE gossip every 20 seconds on average. 0 disables gossipping of STABLE messages
stability_delay
long stability_delay
- delay before we send STABILITY msg (give others a change to send first). This should be set to a very
small number (> 0 !) if
max_bytesis used
stability_task
STABLE.StabilitySendTask stability_task
stability_mutex
final java.lang.Object stability_mutex
stable_task
STABLE.StableTask stable_task
stable_task_mutex
final java.lang.Object stable_task_mutex
timer
org.jgroups.util.TimeScheduler timer
name
static final java.lang.String name
- See Also:
- Constant Field Values
max_bytes
long max_bytes
- Total amount of bytes from incoming messages (default = 0 = disabled). When exceeded, a STABLE
message will be broadcast and
num_bytes_receivedreset to 0 . If this is > 0, then ideallystability_delayshould be set to a low number as well
num_bytes_received
long num_bytes_received
- The total number of bytes received from unicast and multicast messages
suspended
boolean suspended
- When true, don't take part in garbage collection protocol: neither send STABLE messages nor
handle STABILITY messages
initialized
boolean initialized
resume_task
STABLE.ResumeTask resume_task
resume_task_mutex
final java.lang.Object resume_task_mutex
num_gossips
int num_gossips
- Number of gossip messages
| Constructor Detail |
STABLE
public STABLE()
| Method Detail |
getName
public java.lang.String getName()
getDesiredAverageGossip
public long getDesiredAverageGossip()
setDesiredAverageGossip
public void setDesiredAverageGossip(long gossip_interval)
getMaxBytes
public long getMaxBytes()
setMaxBytes
public void setMaxBytes(long max_bytes)
getNumberOfGossipMessages
public int getNumberOfGossipMessages()
resetStats
public void resetStats()
requiredDownServices
public java.util.Vector requiredDownServices()
- Description copied from class:
org.jgroups.stack.Protocol - List of events that are required to be answered by some layer below.
setProperties
public boolean setProperties(java.util.Properties props)
- Description copied from class:
org.jgroups.stack.Protocol - Configures the protocol initially. A configuration string consists of name=value
items, separated by a ';' (semicolon), e.g.:
"loopback=false;unicast_inport=4444"
suspend
private void suspend(long timeout)
resume
private void resume()
start
public void start()
throws java.lang.Exception
- Description copied from class:
org.jgroups.stack.Protocol - This method is called on a Channel.connect(String)>
Channel.connect(String)55 . Starts work. Protocols are connected and queues are ready to receive events. Will be called from bottom to top. This call will replace the START and START_OK events.
stop
public void stop()
- Description copied from class:
org.jgroups.stack.Protocol - This method is called on a Channel.disconnect()>
Channel.disconnect()55 . 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
up
public void up(org.jgroups.Event evt)
- Description copied from class:
org.jgroups.stack.Protocol - An event was received from the layer below. Usually the current layer will want to examine
the event type and - depending on its type - perform some computation
(e.g. removing headers from a MSG event type, or updating the internal membership list
when receiving a VIEW_CHANGE event).
Finally the event is either a) discarded, or b) an event is sent down
the stack using
passDown()or c) the event (or another event) is sent up the stack usingpassUp().
down
public void down(org.jgroups.Event evt)
- Description copied from class:
org.jgroups.stack.Protocol - An event is to be sent down the stack. The layer may want to examine its type and perform
some action on it, depending on the event's type. If the event is a message MSG, then
the layer may need to add a header to it (or do nothing at all) before sending it down
the stack using
passDown(). 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 usingpassUp().
runMessageGarbageCollection
public void runMessageGarbageCollection()
handleViewChange
private void handleViewChange(org.jgroups.View v)
adjustSenders
private void adjustSenders(Digest d, java.util.Vector members)
- Digest and members are guaranteed to be non-null
clearDigest
private void clearDigest()
updateLocalDigest
private boolean updateLocalDigest(Digest d, org.jgroups.Address sender)
- Update my own digest from a digest received by somebody else. Returns whether the update was successful.
Needs to be called with a lock on digest
resetDigest
private void resetDigest(java.util.Vector new_members)
removeFromHeardFromList
private boolean removeFromHeardFromList(org.jgroups.Address mbr)
- Removes mbr from heard_from and returns true if this was the last member, otherwise false.
Resets the heard_from list (populates with membership)
startStableTask
void startStableTask()
stopStableTask
void stopStableTask()
startResumeTask
void startResumeTask(long max_suspend_time)
stopResumeTask
void stopResumeTask()
startStabilityTask
void startStabilityTask(Digest d, long delay)
stopStabilityTask
void stopStabilityTask()
handleStableMessage
private void handleStableMessage(org.jgroups.Address sender, Digest d)
- Digest d contains (a) the highest seqnos deliverable for each sender and (b) the highest seqnos
seen for each member. (Difference: with 1,2,4,5, the highest seqno seen is 5, whereas the highest
seqno deliverable is 2). The minimum of all highest seqnos deliverable will be taken to send a stability
message, which results in garbage collection of messages lower than the ones in the stability vector. The
maximum of all seqnos will be taken to trigger possible retransmission of last missing seqno (see DESIGN
for details).
sendStableMessage
private void sendStableMessage(Digest d)
- Bcasts a STABLE message of the current digest to all members. Message contains highest seqnos of all members
seen by this member. Highest seqnos are retrieved from the NAKACK layer below.
sendStabilityMessage
void sendStabilityMessage(Digest tmp)
- Schedules a stability message to be mcast after a random number of milliseconds (range 1-5 secs).
The reason for waiting a random amount of time is that, in the worst case, all members receive a
STABLE_GOSSIP message from the last outstanding member at the same time and would therefore mcast the
STABILITY message at the same time too. To avoid this, each member waits random N msecs. If, before N
elapses, some other member sent the STABILITY message, we just cancel our own message. If, during
waiting for N msecs to send STABILITY message S1, another STABILITY message S2 is to be sent, we just
discard S2.
handleStabilityMessage
void handleStabilityMessage(Digest d, org.jgroups.Address sender)
|
|||||||||
| Home >> All >> org >> jgroups >> protocols >> [ pbcast overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC