Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bugfix: filled buffers in the serializedOutgoingQueue were counted mu…

…ltiple times as being filled
  • Loading branch information...
commit 443e102f98b052aa62ec757abf55178ced2506d6 1 parent 4bccc1d
Claudiu Dan Gheorghe authored
2  src/nl/vu/cs/amstel/msg/MessageOutputBuffer.java
@@ -14,6 +14,8 @@
14 14 public MessageOutputBuffer<M> prev = null;
15 15 public MessageOutputBuffer<M> next = null;
16 16
  17 + public boolean markAsFilled = false;
  18 +
17 19 private DataOutputStream dataStream = new DataOutputStream(this);
18 20 private String dst; // destination vertex
19 21
12 src/nl/vu/cs/amstel/msg/SerializedOutgoingQueue.java
@@ -45,6 +45,10 @@
45 45 tail = null;
46 46 }
47 47 nonemptyBuffers--;
  48 + if (buffer.markAsFilled) {
  49 + filledBuffers--;
  50 + }
  51 + buffer.markAsFilled = false;
48 52 return buffer;
49 53 }
50 54
@@ -107,8 +111,8 @@ private void checkList() {
107 111 for (b = tail, l2 = 0; b != null && l2 < nonemptyBuffers; l2++, b = b.prev) {
108 112 }
109 113 if (b != null) {
110   - System.exit(1);
111 114 logger.fatal("List is corrupt");
  115 + System.exit(1);
112 116 }
113 117 }
114 118
@@ -148,7 +152,8 @@ public void add(String toVertex, M msg) throws IOException {
148 152 tail = buffer;
149 153 }
150 154 buffer.write(msg);
151   - if (buffer.size() > FILLED_BUFF_SIZE_THOLD) {
  155 + if (buffer.size() > FILLED_BUFF_SIZE_THOLD && !buffer.markAsFilled) {
  156 + buffer.markAsFilled = true;
152 157 filledBuffers++;
153 158 }
154 159 // we have just written data in the buffer,
@@ -166,8 +171,7 @@ public void add(String toVertex, M msg) throws IOException {
166 171
167 172 public void flushFilledBuffers(WriteMessage w) throws IOException {
168 173 // we know that are at least this number of filled buffers
169   - sendBulk(w, FILLED_BUFF_CNT_THOLD);
170   - filledBuffers -= FILLED_BUFF_CNT_THOLD;
  174 + sendBulk(w, filledBuffers);
171 175 }
172 176
173 177 public void flush(WriteMessage w) throws IOException {

0 comments on commit 443e102

Please sign in to comment.
Something went wrong with that request. Please try again.