You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2018/10/18 14:18:17 UTC
qpid-jms git commit: QPIDJMS-420: add a try-finally to ensure the
decrement occurs
Repository: qpid-jms
Updated Branches:
refs/heads/master 72bbc8060 -> add459362
QPIDJMS-420: add a try-finally to ensure the decrement occurs
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/add45936
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/add45936
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/add45936
Branch: refs/heads/master
Commit: add459362f3ce3544167c3bdb7ac9d9d2c7a6c0c
Parents: 72bbc80
Author: Robbie Gemmell <ro...@apache.org>
Authored: Thu Oct 18 15:17:29 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Thu Oct 18 15:17:29 2018 +0100
----------------------------------------------------------------------
.../apache/qpid/jms/util/AbstractMessageQueue.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/add45936/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
index a3dda4b..788aca3 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/AbstractMessageQueue.java
@@ -43,14 +43,17 @@ public abstract class AbstractMessageQueue implements MessageQueue {
// Wait until the consumer is ready to deliver messages.
while (timeout != 0 && !closed && isEmpty() && running) {
waiters++;
- if (timeout == -1) {
- lock.wait();
- } else {
- long start = System.currentTimeMillis();
- lock.wait(timeout);
- timeout = Math.max(timeout + start - System.currentTimeMillis(), 0);
+ try {
+ if (timeout == -1) {
+ lock.wait();
+ } else {
+ long start = System.currentTimeMillis();
+ lock.wait(timeout);
+ timeout = Math.max(timeout + start - System.currentTimeMillis(), 0);
+ }
+ } finally {
+ waiters--;
}
- waiters--;
}
if (closed || !running || isEmpty()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org