/** Schedules a stability message to be mcast after a random number of milliseconds (range [1-stability_delay] 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. @param tmp A copy of the stability digest, so we don't need to copy it again */ protected void sendStabilityMessage(Digest tmp, final ViewId view_id) { if(send_stable_msgs_to_coord_only || stability_delay <= 1) _sendStabilityMessage(tmp, view_id); else { // give other members a chance to mcast STABILITY message. if we receive STABILITY by the end of our random // sleep, we will not send the STABILITY msg. this prevents that all mbrs mcast a STABILITY msg at the same time startStabilityTask(tmp, view_id, Util.random(stability_delay)); } }
/** 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. @param tmp A copy of te stability digest, so we don't need to copy it again */ private void sendStabilityMessage(Digest tmp) { long delay; if(suspended) { if(log.isTraceEnabled()) log.trace("STABILITY message will not be sent as I'm suspended"); return; } // give other members a chance to mcast STABILITY message. if we receive STABILITY by the end of // our random sleep, we will not send the STABILITY msg. this prevents that all mbrs mcast a // STABILITY msg at the same time delay=Util.random(stability_delay); if(log.isTraceEnabled()) log.trace("sending stability msg (in " + delay + " ms) " + tmp.printHighestDeliveredSeqnos() + " (copy=" + tmp.hashCode() + ")"); startStabilityTask(tmp, delay); }
/** Schedules a stability message to be mcast after a random number of milliseconds (range [1-stability_delay] 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. @param tmp A copy of the stability digest, so we don't need to copy it again */ protected void sendStabilityMessage(Digest tmp, final ViewId view_id) { if(send_stable_msgs_to_coord_only || stability_delay <= 1) _sendStabilityMessage(tmp, view_id); else { // give other members a chance to mcast STABILITY message. if we receive STABILITY by the end of our random // sleep, we will not send the STABILITY msg. this prevents that all mbrs mcast a STABILITY msg at the same time startStabilityTask(tmp, view_id, Util.random(stability_delay)); } }