Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added bounded list of last 10 retransmissions

  • Loading branch information...
commit 2ba13037d1d032f4052c8245601a8ff046ce5f5f 1 parent 06b9c71
@belaban authored
View
6 src/org/jgroups/jmx/protocols/pbcast/NAKACK.java
@@ -4,7 +4,7 @@
/**
* @author Bela Ban
- * @version $Id: NAKACK.java,v 1.6 2005/11/08 11:08:32 belaban Exp $
+ * @version $Id: NAKACK.java,v 1.7 2007/03/21 14:41:14 belaban Exp $
*/
public class NAKACK extends Protocol implements NAKACKMBean {
org.jgroups.protocols.pbcast.NAKACK p;
@@ -110,4 +110,8 @@ public String printMessages() {
return p.printMessages();
}
+ public String printStabilityMessages() {
+ return p.printStabilityMessages();
+ }
+
}
View
3  src/org/jgroups/jmx/protocols/pbcast/NAKACKMBean.java
@@ -4,7 +4,7 @@
/**
* @author Bela Ban
- * @version $Id: NAKACKMBean.java,v 1.5 2005/11/08 11:08:21 belaban Exp $
+ * @version $Id: NAKACKMBean.java,v 1.6 2007/03/21 14:41:14 belaban Exp $
*/
public interface NAKACKMBean extends ProtocolMBean {
int getGcLag();
@@ -29,4 +29,5 @@
int getPendingRetransmissionRequests();
String printSentMessages();
String printMessages();
+ String printStabilityMessages();
}
View
21 src/org/jgroups/protocols/pbcast/NAKACK.java
@@ -36,7 +36,7 @@
* vsync.
*
* @author Bela Ban
- * @version $Id: NAKACK.java,v 1.117 2007/03/21 11:18:33 belaban Exp $
+ * @version $Id: NAKACK.java,v 1.118 2007/03/21 14:41:15 belaban Exp $
*/
public class NAKACK extends Protocol implements Retransmitter.RetransmitCommand, NakReceiverWindow.Listener {
private long[] retransmit_timeout={600, 1200, 2400, 4800}; // time(s) to wait before requesting retransmission
@@ -123,6 +123,9 @@
private static final int NUM_REBROADCAST_MSGS=3;
+ /** keeps the last 10 stability messages */
+ private final BoundedList stability_msgs=new BoundedList(10);
+
public NAKACK() {
@@ -364,9 +367,17 @@ public String printStats() {
sb.append(missing).append("\n");
}
+ sb.append("\nStability messages received\n");
+ sb.append(printStabilityMessages()).append("\n");
+
return sb.toString();
}
+ public String printStabilityMessages() {
+ StringBuilder sb=new StringBuilder();
+ sb.append(stability_msgs.toStringWithDelimiter("\n"));
+ return sb.toString();
+ }
public Vector providedUpServices() {
@@ -703,10 +714,6 @@ private void handleXmitReq(Address xmit_requester, long first_seqno, long last_s
NakReceiverWindow win=null;
boolean amISender; // am I the original sender ?
- // System.out.println("-- [" +local_addr + "] received XMIT_REQ from " + xmit_requester + " for " + first_seqno +
- // " - " + last_seqno);
-
-
if(trace) {
StringBuilder sb=new StringBuilder();
sb.append(local_addr).append(": received xmit request from ").append(xmit_requester).append(" for ");
@@ -865,7 +872,6 @@ private void handleXmitRsp(Message msg) {
if(rebroadcasting && count > 0) {
Digest tmp=getDigest();
if(tmp.isGreaterThanOrEqual(rebroadcast_digest)) {
- // System.out.println("CANCEL rebroadcasting");
cancelRebroadcasting();
}
}
@@ -909,7 +915,6 @@ private void rebroadcastMessages() {
their_high=their_entry.getHighest();
my_high=my_entry.getHighest();
if(their_high > my_high) {
- //System.out.println("sending XMIT request to " + sender + " for messages " + my_high + " - " + their_high);
if(trace)
log.trace("sending XMIT request to " + sender + " for messages " + my_high + " - " + their_high);
retransmit(my_high, their_high, sender);
@@ -1205,6 +1210,8 @@ private void stable(Digest d) {
log.trace("received stable digest " + d);
}
+ stability_msgs.add(d);
+
Map.Entry entry;
Address sender;
org.jgroups.protocols.pbcast.Digest.Entry val;
View
25 src/org/jgroups/util/List.java
@@ -1,4 +1,4 @@
-// $Id: List.java,v 1.12 2006/10/10 15:46:24 belaban Exp $
+// $Id: List.java,v 1.13 2007/03/21 14:41:15 belaban Exp $
package org.jgroups.util;
@@ -216,7 +216,7 @@ public int size() {
}
public String toString() {
- StringBuffer ret=new StringBuffer("[");
+ StringBuilder ret=new StringBuilder("[");
Element el=head;
while(el != null) {
@@ -228,9 +228,26 @@ public String toString() {
return ret.toString();
}
+ public String toStringWithDelimiter(String delimiter) {
+ Element el=head;
+ boolean first=true;
+ StringBuilder sb=new StringBuilder();
+ while(el != null) {
+ if(first) {
+ first=false;
+ }
+ else {
+ sb.append(delimiter);
+ }
+ sb.append(el.obj);
+ el=el.next;
+ }
+ return sb.toString();
+ }
+
public String dump() {
- StringBuffer ret=new StringBuffer("[");
+ StringBuilder ret=new StringBuilder("[");
for(Element el=head; el != null; el=el.next)
ret.append(el.obj).append(" ");
@@ -428,6 +445,8 @@ public static void main(String[] args) {
l.addAtHead(new Integer(4));
l.addAtHead(new Integer(5));
+ System.out.println("list: " + l.toStringWithDelimiter(", "));
+
System.out.println("Removed from head: " + l.removeFromHead());
System.out.println("Removed from head: " + l.removeFromHead());
System.out.println("Removed from head: " + l.removeFromHead());
Please sign in to comment.
Something went wrong with that request. Please try again.