Package org.jgroups.protocols.pbcast
Class NAKACK
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.pbcast.NAKACK
- All Implemented Interfaces:
TP.ProbeHandler,NakReceiverWindow.Listener,Retransmitter.RetransmitCommand
public class NAKACK
extends Protocol
implements Retransmitter.RetransmitCommand, NakReceiverWindow.Listener, TP.ProbeHandler
Negative AcKnowledgement layer (NAKs). Messages are assigned a monotonically
increasing sequence number (seqno). Receivers deliver messages ordered
according to seqno and request retransmission of missing messages.
Retransmit requests are usually sent to the original sender of a message, but this can be changed by xmit_from_random_member (send to random member) or use_mcast_xmit_req (send to everyone). Responses can also be sent to everyone instead of the requester by setting use_mcast_xmit to true.
Retransmit requests are usually sent to the original sender of a message, but this can be changed by xmit_from_random_member (send to random member) or use_mcast_xmit_req (send to everyone). Responses can also be sent to everyone instead of the requester by setting use_mcast_xmit to true.
- Author:
- Bela Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BoundedList<String> Keeps a bounded list of the last N digest setsprotected booleanWhen not finding a message on an XMIT request, include the last N stability messages in the error messageprotected final BoundedList<Digest> BoundedList, keeps the last 10 stability messages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidcompact()Callback.doubledoublelongReturns a message digest: for each member P the lowest, highest delivered and highest received seqno is addedintgetGcLag()Deprecated.booleanstatic intDeprecated.static longDeprecated.removed in 2.6longintintdoubleReturns the smoothed average retransmission time for a given senderdoubledoublestatic intDeprecated.Please don't use this method; it is only provided for unit testing !longlonglonglonginthandleProbe(String... keys) Handles a probe.voidinit()Called after instance has been created (null constructor) and before protocol is started.booleanbooleanbooleanvoidmessageGapDetected(long from, long to, Address src) Called when a message gap is detectedvoidmissingMessageReceived(long seqno, Address original_sender) List of events that are provided to layers above (they will be handled when sent down from above).voidvoidretransmit(long first_seqno, long last_seqno, Address sender) Implementation of Retransmitter.RetransmitCommand.protected voidretransmit(long first_seqno, long last_seqno, Address sender, boolean multicast_xmit_request) voidsetDiscardDeliveredMsgs(boolean discard_delivered_msgs) voidsetGcLag(int gc_lag) Deprecated.voidsetLogDiscardMessages(boolean flag) voidsetLogDiscardMsgs(boolean flag) static voidsetMaxXmitBufSize(int max_xmit_buf_size) Deprecated.voidsetMaxXmitSize(long max_xmit_size) Deprecated.removed in 2.6voidsetTimer(TimeScheduler timer) Only used for unit tests, don't use !voidsetUseMcastXmit(boolean use_mcast_xmit) voidsetXmitFromRandomMember(boolean xmit_from_random_member) voidstart()This method is called on aChannel.connect(String).voidstop()This method is called on aChannel.disconnect().String[]Returns a list of supported keysCallback.Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Field Details
-
print_stability_history_on_failed_xmit
protected boolean print_stability_history_on_failed_xmitWhen not finding a message on an XMIT request, include the last N stability messages in the error message -
stability_msgs
BoundedList, keeps the last 10 stability messages -
digest_history
Keeps a bounded list of the last N digest sets
-
-
Constructor Details
-
NAKACK
public NAKACK()
-
-
Method Details
-
getUndeliveredMessages
Deprecated. -
getXmitRequestsReceived
public long getXmitRequestsReceived() -
getXmitRequestsSent
public long getXmitRequestsSent() -
getXmitResponsesReceived
public long getXmitResponsesReceived() -
getXmitResponsesSent
public long getXmitResponsesSent() -
getMissingMessagesReceived
public long getMissingMessagesReceived() -
getPendingRetransmissionRequests
public int getPendingRetransmissionRequests() -
getXmitTableSize
public int getXmitTableSize() -
getCurrentSeqno
public long getCurrentSeqno() -
printRetransmitStats
-
getReceivedTableSize
public int getReceivedTableSize() -
getWindow
Please don't use this method; it is only provided for unit testing !- Parameters:
mbr-- Returns:
-
setTimer
Only used for unit tests, don't use !- Parameters:
timer-
-
resetStats
public void resetStats()- Overrides:
resetStatsin classProtocol
-
init
Description copied from class:ProtocolCalled after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent. -
getGcLag
Deprecated. -
setGcLag
Deprecated. -
isUseMcastXmit
public boolean isUseMcastXmit() -
setUseMcastXmit
public void setUseMcastXmit(boolean use_mcast_xmit) -
isXmitFromRandomMember
public boolean isXmitFromRandomMember() -
setXmitFromRandomMember
public void setXmitFromRandomMember(boolean xmit_from_random_member) -
isDiscardDeliveredMsgs
public boolean isDiscardDeliveredMsgs() -
setDiscardDeliveredMsgs
public void setDiscardDeliveredMsgs(boolean discard_delivered_msgs) -
getMaxXmitBufSize
Deprecated. -
setMaxXmitBufSize
Deprecated. -
getMaxXmitSize
public static long getMaxXmitSize()Deprecated.removed in 2.6- Returns:
-
setMaxXmitSize
public void setMaxXmitSize(long max_xmit_size) Deprecated.removed in 2.6- Parameters:
max_xmit_size-
-
setLogDiscardMessages
public void setLogDiscardMessages(boolean flag) -
setLogDiscardMsgs
public void setLogDiscardMsgs(boolean flag) -
getLogDiscardMessages
public boolean getLogDiscardMessages() -
dumpStats
-
printStats
- Overrides:
printStatsin classProtocol
-
printStabilityMessages
-
printStabilityHistory
-
printDigestHistory
-
printLossRates
-
printRetransmitTableSizes
-
compact
public void compact() -
getAverageLossRate
public double getAverageLossRate() -
getAverageSmoothedLossRate
public double getAverageSmoothedLossRate() -
providedUpServices
Description copied from class:ProtocolList of events that are provided to layers above (they will be handled when sent down from above).- Overrides:
providedUpServicesin classProtocol- Returns:
- Vector (of Integers)
-
start
Description copied from class:ProtocolThis method is called on aChannel.connect(String). 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.- Overrides:
startin classProtocol- Throws:
Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soChannel.connect(String)will throw an exception
-
stop
public void stop()Description copied from class:ProtocolThis method is called on aChannel.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 -
down
Callback. Called by superclass when event may be handled.Do not use
down_prot.down()in this method as the event is passed down by default by the superclass after this method returns ! -
up
Callback. Called by superclass when event may be handled.Do not use
PassUpin this method as the event is passed up by default by the superclass after this method returns ! -
checkForRebroadcasts
protected void checkForRebroadcasts() -
getDigest
Returns a message digest: for each member P the lowest, highest delivered and highest received seqno is added -
retransmit
Implementation of Retransmitter.RetransmitCommand. Called by retransmission thread when gap is detected.- Specified by:
retransmitin interfaceRetransmitter.RetransmitCommand- Parameters:
first_seqno- The sequence number of the first missing messagelast_seqno- The sequence number of the last missing messagesender- The destination of the member to which the retransmit request will be sent (nak-based scheme), or to which the message will be retransmitted (ack-based scheme).
-
retransmit
protected void retransmit(long first_seqno, long last_seqno, Address sender, boolean multicast_xmit_request) -
missingMessageReceived
- Specified by:
missingMessageReceivedin interfaceNakReceiverWindow.Listener
-
messageGapDetected
Called when a message gap is detected- Specified by:
messageGapDetectedin interfaceNakReceiverWindow.Listener
-
printMessages
-
printRetransmissionAvgs
-
printSmoothedRetransmissionAvgs
-
printRetransmissionTimes
-
printXmitHistory
-
getTotalAverageRetransmissionTime
public double getTotalAverageRetransmissionTime() -
getTotalAverageSmoothedRetransmissionTime
public double getTotalAverageSmoothedRetransmissionTime() -
getSmoothedAverageRetransmissionTime
Returns the smoothed average retransmission time for a given sender -
handleProbe
Description copied from interface:TP.ProbeHandlerHandles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
handleProbein interfaceTP.ProbeHandler- Parameters:
keys-- Returns:
- Mapinvalid input: '<'String,String>. A map of keys and values. A null return value is permissible.
-
supportedKeys
Description copied from interface:TP.ProbeHandlerReturns a list of supported keys- Specified by:
supportedKeysin interfaceTP.ProbeHandler
-