Package org.jgroups.protocols.pbcast
Class NAKACK
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.pbcast.NAKACK
-
- All Implemented Interfaces:
NakReceiverWindow.Listener
,Retransmitter.RetransmitCommand
public class NAKACK extends Protocol implements Retransmitter.RetransmitCommand, NakReceiverWindow.Listener
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.- Version:
- $Id: NAKACK.java,v 1.170.2.16.2.6 2009/05/04 14:11:33 belaban Exp $
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected BoundedList<java.lang.String>
merge_history
protected boolean
print_stability_history_on_failed_xmit
When not finding a message on an XMIT request, include the last N stability messages in the error messageprotected BoundedList<Digest>
stability_msgs
BoundedList, keeps the last 10 stability messages
-
Constructor Summary
Constructors Constructor Description NAKACK()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Object
down(Event evt)
Callback.java.util.Map<java.lang.String,java.lang.Object>
dumpStats()
double
getAverageLossRate()
double
getAverageSmoothedLossRate()
Digest
getDigest()
Returns a message digest: for each member P the lowest, highest delivered and highest received seqno is addedint
getGcLag()
int
getMaxXmitBufSize()
long
getMaxXmitSize()
Deprecated.removed in 2.6long
getMissingMessagesReceived()
java.lang.String
getName()
int
getPendingRetransmissionRequests()
int
getReceivedTableSize()
double
getSmoothedAverageRetransmissionTime(Address sender)
Returns the smoothed average retransmission time for a given senderdouble
getTotalAverageRetransmissionTime()
double
getTotalAverageSmoothedRetransmissionTime()
long
getXmitRequestsReceived()
long
getXmitRequestsSent()
long
getXmitResponsesReceived()
long
getXmitResponsesSent()
int
getXmitTableSize()
void
init()
Called after instance has been created (null constructor) and before protocol is started.boolean
isDiscardDeliveredMsgs()
boolean
isLogDiscardMsgs()
boolean
isUseMcastXmit()
boolean
isXmitFromRandomMember()
void
messageGapDetected(long from, long to, Address src)
Called when a message gap is detectedvoid
missingMessageReceived(long seqno, Address original_sender)
java.lang.String
printLossRates()
java.lang.String
printMergeHistory()
java.lang.String
printMessages()
java.lang.String
printRetransmissionAvgs()
java.lang.String
printRetransmissionTimes()
java.lang.String
printSmoothedRetransmissionAvgs()
java.lang.String
printStabilityHistory()
java.lang.String
printStabilityMessages()
java.lang.String
printStats()
java.util.Vector<java.lang.Integer>
providedUpServices()
List of events that are provided to layers above (they will be handled when sent down from above).void
resetStats()
void
retransmit(long first_seqno, long last_seqno, Address sender)
Implementation of Retransmitter.RetransmitCommand.protected void
retransmit(long first_seqno, long last_seqno, Address sender, boolean multicast_xmit_request)
void
setDiscardDeliveredMsgs(boolean discard_delivered_msgs)
void
setGcLag(int gc_lag)
void
setLogDiscardMsgs(boolean log_discard_msgs)
void
setMaxXmitBufSize(int max_xmit_buf_size)
void
setMaxXmitSize(long max_xmit_size)
Deprecated.removed in 2.6boolean
setProperties(java.util.Properties props)
Configures the protocol initially.void
setUseMcastXmit(boolean use_mcast_xmit)
void
setXmitFromRandomMember(boolean xmit_from_random_member)
void
start()
This method is called on aChannel.connect(String)
.void
stop()
This method is called on aChannel.disconnect()
.java.lang.Object
up(Event evt)
Callback.-
Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
-
-
-
-
Field Detail
-
stability_msgs
protected final BoundedList<Digest> stability_msgs
BoundedList, keeps the last 10 stability messages
-
merge_history
protected final BoundedList<java.lang.String> merge_history
-
print_stability_history_on_failed_xmit
protected boolean print_stability_history_on_failed_xmit
When not finding a message on an XMIT request, include the last N stability messages in the error message
-
-
Method Detail
-
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()
-
getReceivedTableSize
public int getReceivedTableSize()
-
resetStats
public void resetStats()
- Overrides:
resetStats
in classProtocol
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
Called 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
public int getGcLag()
-
setGcLag
public void setGcLag(int gc_lag)
-
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
public int getMaxXmitBufSize()
-
setMaxXmitBufSize
public void setMaxXmitBufSize(int max_xmit_buf_size)
-
getMaxXmitSize
public 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
-
-
isLogDiscardMsgs
public boolean isLogDiscardMsgs()
-
setLogDiscardMsgs
public void setLogDiscardMsgs(boolean log_discard_msgs)
-
setProperties
public boolean setProperties(java.util.Properties props)
Description copied from class:Protocol
Configures the protocol initially. A configuration string consists of name=value items, separated by a ';' (semicolon), e.g.:"loopback=false;unicast_inport=4444"
- Overrides:
setProperties
in classProtocol
-
dumpStats
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
-
printStats
public java.lang.String printStats()
- Overrides:
printStats
in classProtocol
-
printStabilityMessages
public java.lang.String printStabilityMessages()
-
printStabilityHistory
public java.lang.String printStabilityHistory()
-
printMergeHistory
public java.lang.String printMergeHistory()
-
printLossRates
public java.lang.String printLossRates()
-
getAverageLossRate
public double getAverageLossRate()
-
getAverageSmoothedLossRate
public double getAverageSmoothedLossRate()
-
providedUpServices
public java.util.Vector<java.lang.Integer> providedUpServices()
Description copied from class:Protocol
List of events that are provided to layers above (they will be handled when sent down from above).- Overrides:
providedUpServices
in classProtocol
- Returns:
- Vector (of Integers)
-
start
public void start() throws java.lang.Exception
Description copied from class:Protocol
This 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:
start
in classProtocol
- Throws:
java.lang.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:Protocol
This 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
public java.lang.Object down(Event evt)
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
public java.lang.Object up(Event evt)
Callback. Called by superclass when event may be handled.Do not use
PassUp
in this method as the event is passed up by default by the superclass after this method returns !
-
getDigest
public Digest getDigest()
Returns a message digest: for each member P the lowest, highest delivered and highest received seqno is added
-
retransmit
public void retransmit(long first_seqno, long last_seqno, Address sender)
Implementation of Retransmitter.RetransmitCommand. Called by retransmission thread when gap is detected.- Specified by:
retransmit
in 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
public void missingMessageReceived(long seqno, Address original_sender)
- Specified by:
missingMessageReceived
in interfaceNakReceiverWindow.Listener
-
messageGapDetected
public void messageGapDetected(long from, long to, Address src)
Called when a message gap is detected- Specified by:
messageGapDetected
in interfaceNakReceiverWindow.Listener
-
printMessages
public java.lang.String printMessages()
-
printRetransmissionAvgs
public java.lang.String printRetransmissionAvgs()
-
printSmoothedRetransmissionAvgs
public java.lang.String printSmoothedRetransmissionAvgs()
-
printRetransmissionTimes
public java.lang.String printRetransmissionTimes()
-
getTotalAverageRetransmissionTime
public double getTotalAverageRetransmissionTime()
-
getTotalAverageSmoothedRetransmissionTime
public double getTotalAverageSmoothedRetransmissionTime()
-
getSmoothedAverageRetransmissionTime
public double getSmoothedAverageRetransmissionTime(Address sender)
Returns the smoothed average retransmission time for a given sender
-
-