[ 
https://issues.apache.org/activemq/browse/AMQ-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54055#action_54055
 ] 

Gary Tully commented on AMQ-1112:
---------------------------------

The following diff resolved the hang: need to do some move validation on it 
though as holding the dispatchMutex for the duration of iterate may be a little 
heavy handed :
{code}Index: src/main/java/org/apache/activemq/broker/region/Queue.java
===================================================================
--- src/main/java/org/apache/activemq/broker/region/Queue.java  (revision 
812045)
+++ src/main/java/org/apache/activemq/broker/region/Queue.java  (working copy)
@@ -1081,7 +1081,7 @@
     public boolean iterate() {
         boolean pageInMoreMessages = false;   
         synchronized(iteratingMutex) {
-            
+            synchronized(dispatchMutex) {
             // do early to allow dispatch of these waiting messages
             synchronized(messagesWaitingForSpace) {
                 while (!messagesWaitingForSpace.isEmpty() && 
!memoryUsage.isFull()) {
@@ -1167,6 +1167,7 @@
                }
                return !messagesWaitingForSpace.isEmpty();
         }
+        }
     }
 
     protected MessageReferenceFilter createMessageIdFilter(final String 
messageId) {
@@ -1371,6 +1372,7 @@
     }
 
     private void doDispatch(List<QueueMessageReference> list) throws Exception 
{
+        boolean doWakeUp = false;
         synchronized(dispatchMutex) {
        
             synchronized (pagedInPendingDispatch) {
@@ -1391,11 +1393,14 @@
                                 pagedInPendingDispatch.add(qmr);
                             }
                         }
-                        wakeup();
+                        doWakeUp  = true;
                     }
                 }
             }
         } 
+        if (doWakeUp) {
+            wakeup();
+        }
     }
     
     /**
{code}

> remove expired messages from Store and update Message cursors
> -------------------------------------------------------------
>
>                 Key: AMQ-1112
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1112
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.0.0
>            Reporter: Rob Davies
>            Assignee: Gary Tully
>             Fix For: 5.3.0
>
>
> Ensure messages that are expired are removed from message store and message 
> cursrors are also updated consistently

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to