Class NAKACK

java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.pbcast.NAKACK
All Implemented Interfaces:
TP.ProbeHandler, NakReceiverWindow.Listener, Retransmitter.RetransmitCommand

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.
Author:
Bela Ban
  • Field Details

    • stability_msgs

      protected final BoundedList<Digest> stability_msgs
      BoundedList, keeps the last 10 stability messages
    • digest_history

      protected final BoundedList<String> digest_history
      Keeps a bounded list of the last N digest sets
  • Constructor Details

    • NAKACK

      public NAKACK()
  • Method Details

    • getUndeliveredMessages

      @Deprecated public static int 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

      public String printRetransmitStats()
    • getReceivedTableSize

      public int getReceivedTableSize()
    • getWindow

      public NakReceiverWindow getWindow(Address mbr)
      Please don't use this method; it is only provided for unit testing !
      Parameters:
      mbr -
      Returns:
    • setTimer

      public void setTimer(TimeScheduler timer)
      Only used for unit tests, don't use !
      Parameters:
      timer -
    • resetStats

      public void resetStats()
      Overrides:
      resetStats in class Protocol
    • init

      public void init() throws 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.
      Overrides:
      init in class Protocol
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
    • getGcLag

      @Deprecated public int getGcLag()
      Deprecated.
    • setGcLag

      @Deprecated public void setGcLag(int gc_lag)
      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 public static int getMaxXmitBufSize()
      Deprecated.
    • setMaxXmitBufSize

      @Deprecated public static void setMaxXmitBufSize(int max_xmit_buf_size)
      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

      public Map<String,Object> dumpStats()
      Overrides:
      dumpStats in class Protocol
    • printStats

      public String printStats()
      Overrides:
      printStats in class Protocol
    • printStabilityMessages

      public String printStabilityMessages()
    • printStabilityHistory

      public String printStabilityHistory()
    • printDigestHistory

      public String printDigestHistory()
    • printLossRates

      public String printLossRates()
    • printRetransmitTableSizes

      public String printRetransmitTableSizes()
    • compact

      public void compact()
    • getAverageLossRate

      public double getAverageLossRate()
    • getAverageSmoothedLossRate

      public double getAverageSmoothedLossRate()
    • providedUpServices

      public Vector<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 class Protocol
      Returns:
      Vector (of Integers)
    • start

      public void start() throws Exception
      Description copied from class: Protocol
      This method is called on a Channel.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 class Protocol
      Throws:
      Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so Channel.connect(String) will throw an exception
    • stop

      public void stop()
      Description copied from class: Protocol
      This method is called on a 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
      Overrides:
      stop in class Protocol
    • down

      public 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 !

      Overrides:
      down in class Protocol
    • up

      public 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 !

      Overrides:
      up in class Protocol
    • checkForRebroadcasts

      protected void checkForRebroadcasts()
    • 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 interface Retransmitter.RetransmitCommand
      Parameters:
      first_seqno - The sequence number of the first missing message
      last_seqno - The sequence number of the last missing message
      sender - 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 interface NakReceiverWindow.Listener
    • messageGapDetected

      public void messageGapDetected(long from, long to, Address src)
      Called when a message gap is detected
      Specified by:
      messageGapDetected in interface NakReceiverWindow.Listener
    • printMessages

      public String printMessages()
    • printRetransmissionAvgs

      public String printRetransmissionAvgs()
    • printSmoothedRetransmissionAvgs

      public String printSmoothedRetransmissionAvgs()
    • printRetransmissionTimes

      public String printRetransmissionTimes()
    • printXmitHistory

      public String printXmitHistory()
    • getTotalAverageRetransmissionTime

      public double getTotalAverageRetransmissionTime()
    • getTotalAverageSmoothedRetransmissionTime

      public double getTotalAverageSmoothedRetransmissionTime()
    • getSmoothedAverageRetransmissionTime

      public double getSmoothedAverageRetransmissionTime(Address sender)
      Returns the smoothed average retransmission time for a given sender
    • handleProbe

      public Map<String,String> handleProbe(String... keys)
      Description copied from interface: TP.ProbeHandler
      Handles a probe. For each key that is handled, the key and its result should be in the returned map.
      Specified by:
      handleProbe in interface TP.ProbeHandler
      Parameters:
      keys -
      Returns:
      Mapinvalid input: '<'String,String>. A map of keys and values. A null return value is permissible.
    • supportedKeys

      public String[] supportedKeys()
      Description copied from interface: TP.ProbeHandler
      Returns a list of supported keys
      Specified by:
      supportedKeys in interface TP.ProbeHandler