Skip to content

Commit 434f9f9

Browse files
author
Alexandru Scvortov
committed
MCM: more fine-grained synchronized { } blocks
1 parent c3eb3ce commit 434f9f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/src/com/rabbitmq/examples/MulticastMain.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public synchronized void handleBasicReturn(int replyCode,
287287
returnCount++;
288288
}
289289

290-
public synchronized void handleAck(long seqNo, boolean multiple) {
290+
public void handleAck(long seqNo, boolean multiple) {
291291
int numConfirms = 0;
292292
if (multiple) {
293293
for (long i = ackSet.first(); i <= seqNo; ++i) {
@@ -300,7 +300,7 @@ public synchronized void handleAck(long seqNo, boolean multiple) {
300300
ackSet.remove(seqNo);
301301
numConfirms = 1;
302302
}
303-
confirmCount += numConfirms;
303+
addConfirms(numConfirms);
304304

305305
if (confirmPool != null) {
306306
for (int i = 0; i < numConfirms; ++i) {
@@ -309,6 +309,10 @@ public synchronized void handleAck(long seqNo, boolean multiple) {
309309
}
310310
}
311311

312+
private synchronized void addConfirms(int numConfirms) {
313+
confirmCount += numConfirms;
314+
}
315+
312316
public synchronized void resetCounts() {
313317
msgCount = 0;
314318
returnCount = 0;

0 commit comments

Comments
 (0)