This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 54f4cb5 ARTEMIS-3636 LinkedListImpl leak on mesage consume error
54f4cb5 is described below
commit 54f4cb560c5781cd5921aa6a2d55ef038e9056aa
Author: Justin Bertram <[email protected]>
AuthorDate: Tue Jan 11 15:17:52 2022 -0600
ARTEMIS-3636 LinkedListImpl leak on mesage consume error
---
.../artemis/core/client/impl/ClientConsumerImpl.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
index c4723f1..9936290 100644
---
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
+++
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
@@ -19,7 +19,6 @@ package org.apache.activemq.artemis.core.client.impl;
import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
@@ -43,6 +42,7 @@ import
org.apache.activemq.artemis.spi.core.remoting.SessionContext;
import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.apache.activemq.artemis.utils.TokenBucketLimiter;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.apache.activemq.artemis.utils.collections.PriorityLinkedList;
import org.apache.activemq.artemis.utils.collections.PriorityLinkedListImpl;
import org.jboss.logging.Logger;
@@ -710,10 +710,8 @@ public final class ClientConsumerImpl implements
ClientConsumerInternal {
synchronized (this) {
// Need to send credits for the messages in the buffer
- Iterator<ClientMessageInternal> iter = buffer.iterator();
-
- while (iter.hasNext()) {
- try {
+ try (LinkedListIterator<ClientMessageInternal> iter =
buffer.iterator()) {
+ while (iter.hasNext()) {
ClientMessageInternal message = iter.next();
if (message.isLargeMessage()) {
@@ -722,9 +720,9 @@ public final class ClientConsumerImpl implements
ClientConsumerInternal {
}
flowControlBeforeConsumption(message);
- } catch (Exception e) {
- ActiveMQClientLogger.LOGGER.errorClearingMessages(e);
}
+ } catch (Exception e) {
+ ActiveMQClientLogger.LOGGER.errorClearingMessages(e);
}
clearBuffer();