You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/10/26 11:56:05 UTC
[activemq-artemis] branch main updated: ARTEMIS-4073 Relaxing some locks that were not necessary and were causing dead locks on the testsuite
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 0da14a303d ARTEMIS-4073 Relaxing some locks that were not necessary and were causing dead locks on the testsuite
0da14a303d is described below
commit 0da14a303dfac85e990ce49f4266d6ce5a3ddd57
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Wed Oct 26 04:44:20 2022 -0400
ARTEMIS-4073 Relaxing some locks that were not necessary and were causing dead locks on the testsuite
---
.../core/paging/cursor/impl/PageSubscriptionCounterImpl.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
index 07ca0373b6..6ca73feb19 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java
@@ -185,7 +185,7 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter {
}
@Override
- public synchronized void increment(Transaction tx, int add, long size) throws Exception {
+ public void increment(Transaction tx, int add, long size) throws Exception {
if (tx == null) {
if (persistent) {
long id = storage.storePageCounterInc(this.subscriptionID, add, size);
@@ -316,7 +316,7 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter {
}
// you need to call this method from the executors when id > 0
- private synchronized void doIncrement(long id, int variance, long size) {
+ private void doIncrement(long id, int variance, long size) {
value.addAndGet(variance);
this.persistentSize.addAndGet(size);
if (variance > 0) {
@@ -326,9 +326,11 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter {
addedPersistentSize.addAndGet(size);
}
if (id >= 0) {
- incrementRecords.add(id);
- if (incrementRecords.size() > FLUSH_COUNTER) {
- this.cleanup();
+ synchronized (this) {
+ incrementRecords.add(id);
+ if (incrementRecords.size() > FLUSH_COUNTER) {
+ this.cleanup();
+ }
}
}
}