This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 4111707c268189ed8d7c96275bc366e207492dee
Author: yb <17061955@cn.suning.com>
AuthorDate: Thu Jan 31 17:20:06 2019 +0800
ARTEMIS-2244 checkDepage method placed outside CRITICAL_DELIVER avoid critical analyzer
timeout
(cherry picked from commit 8799615a136946c39bb49bd4069cff2df0035997)
---
.../activemq/artemis/core/server/impl/QueueImpl.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index c80d4f3..ffc179b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -2215,7 +2215,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
* This method will deliver as many messages as possible until all consumers are busy
or there
* are no more matching or available messages.
*/
- private void deliver() {
+ private boolean deliver() {
if (logger.isDebugEnabled()) {
logger.debug(this + " doing deliver. messageReferences=" + messageReferences.size());
}
@@ -2240,7 +2240,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
deliverAsync();
- return;
+ return false;
}
if (System.currentTimeMillis() > timeout) {
@@ -2250,7 +2250,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
deliverAsync();
- return;
+ return false;
}
MessageReference ref;
@@ -2261,7 +2261,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
// Need to do these checks inside the synchronized
if (paused || consumerList.isEmpty()) {
- return;
+ return false;
}
if (messageReferences.size() == 0) {
@@ -2405,7 +2405,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
}
}
- checkDepage();
+ return true;
}
private void checkDepage() {
@@ -3204,13 +3204,19 @@ public class QueueImpl extends CriticalComponentImpl implements Queue
{
// We will be using the deliverRunner instance as the guard object to avoid multiple
threads executing
// an asynchronous delivery
enterCritical(CRITICAL_DELIVER);
+ boolean needCheckDepage = false;
try {
synchronized (QueueImpl.this.deliverRunner) {
- deliver();
+ needCheckDepage = deliver();
}
} finally {
leaveCritical(CRITICAL_DELIVER);
}
+
+ if (needCheckDepage) {
+ checkDepage();
+ }
+
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorDelivering(e);
} finally {
|