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 2760a3e911 ARTEMIS-4569 Improving order in which the list is added 
versus cancel call
2760a3e911 is described below

commit 2760a3e911f97ba940f378b4aacb40cd5ee30ebc
Author: Clebert Suconic <clebertsuco...@apache.org>
AuthorDate: Wed Jan 17 22:51:05 2024 -0500

    ARTEMIS-4569 Improving order in which the list is added versus cancel call
    
    I just did some static analysis of this code, and I believe it would be 
better to first add to the list
    before setting the cancel task.
    
    Reason for that is in case the Runnable is dequeued between the add in the 
deQueue and setting the cancel task.
    
    Possibility is remote but my OCD wouldn't let me ignore this small 
possibility.
---
 .../org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
index 0fedf9a647..f21be1ccbd 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
@@ -1035,8 +1035,8 @@ public class PagingStoreImpl implements PagingStore {
    }
 
    private void addToBlockList(AtomicRunnable atomicRunnable, 
Consumer<AtomicRunnable> accepted) {
-      onMemoryFreedRunnables.add(atomicRunnable);
       atomicRunnable.setCancel(onMemoryFreedRunnables::remove);
+      onMemoryFreedRunnables.add(atomicRunnable);
       if (accepted != null) {
          accepted.accept(atomicRunnable);
       }

Reply via email to