[hornetq-commits] JBoss hornetq SVN: r8532 - in trunk/src/main/org/hornetq/core: persistence/impl/journal and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 3 11:26:50 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-12-03 11:26:48 -0500 (Thu, 03 Dec 2009)
New Revision: 8532

Modified:
   trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
   trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
   trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
   trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
   trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
Log:
Removing waitOnCompletion for deleteMatchQueue

Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2009-12-03 16:16:23 UTC (rev 8531)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2009-12-03 16:26:48 UTC (rev 8532)
@@ -442,7 +442,7 @@
          {
             Transaction transaction = resourceManager.removeTransaction(xid);
             transaction.commit(false);
-            server.getStorageManager().waitOnOperations(-1);
+            server.getStorageManager().waitOnOperations();
             long recordID = server.getStorageManager().storeHeuristicCompletion(xid, true);
             resourceManager.putHeuristicCompletion(recordID, xid, true);
             return true;
@@ -461,7 +461,7 @@
          {
             Transaction transaction = resourceManager.removeTransaction(xid);
             transaction.rollback();
-            server.getStorageManager().completeOperations();
+            server.getStorageManager().waitOnOperations();
             long recordID = server.getStorageManager().storeHeuristicCompletion(xid, false);
             resourceManager.putHeuristicCompletion(recordID, xid, false);
             return true;
@@ -577,6 +577,8 @@
    public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception
    {
       postOffice.sendQueueInfoToQueue(new SimpleString(queueName), new SimpleString(address));
+      // blocking on IO. Otherwise the method would return before the operation was finished
+      server.getStorageManager().waitOnOperations();
    }
 
    // NotificationEmitter implementation ----------------------------

Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java	2009-12-03 16:16:23 UTC (rev 8531)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java	2009-12-03 16:26:48 UTC (rev 8532)
@@ -259,6 +259,7 @@
       QueueControlImpl queueControl = new QueueControlImpl(queue,
                                                            address.toString(),
                                                            postOffice,
+                                                           storageManager,
                                                            addressSettingsRepository);
       if (messageCounterManager != null)
       {

Modified: trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java	2009-12-03 16:16:23 UTC (rev 8531)
+++ trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java	2009-12-03 16:26:48 UTC (rev 8532)
@@ -27,6 +27,7 @@
 import org.hornetq.core.message.Message;
 import org.hornetq.core.messagecounter.MessageCounter;
 import org.hornetq.core.messagecounter.impl.MessageCounterHelper;
+import org.hornetq.core.persistence.StorageManager;
 import org.hornetq.core.postoffice.Binding;
 import org.hornetq.core.postoffice.PostOffice;
 import org.hornetq.core.server.MessageReference;
@@ -58,6 +59,8 @@
    private final PostOffice postOffice;
 
    private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
+   
+   private final StorageManager storageManager;
 
    private MessageCounter counter;
 
@@ -79,6 +82,7 @@
    public QueueControlImpl(final Queue queue,
                            final String address,
                            final PostOffice postOffice,
+                           final StorageManager storageManager,
                            final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception
    {
       super(QueueControl.class);
@@ -86,6 +90,7 @@
       this.address = address;
       this.postOffice = postOffice;
       this.addressSettingsRepository = addressSettingsRepository;
+      this.storageManager = storageManager;
    }
 
    // Public --------------------------------------------------------
@@ -272,7 +277,13 @@
    public int removeMessages(final String filterStr) throws Exception
    {
       Filter filter = FilterImpl.createFilter(filterStr);
-      return queue.deleteMatchingReferences(filter);
+      
+      int retValue = queue.deleteMatchingReferences(filter);
+      
+      // Waiting on IO otherwise the JMX operation would return before the operation completed
+      storageManager.waitOnOperations();
+      
+      return retValue;
    }
 
    public boolean expireMessage(final long messageID) throws Exception

Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2009-12-03 16:16:23 UTC (rev 8531)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2009-12-03 16:26:48 UTC (rev 8532)
@@ -317,7 +317,7 @@
 
    public void waitOnOperations() throws Exception
    {
-      waitOnOperations(-1);
+      waitOnOperations(0);
    }
 
    /* (non-Javadoc)
@@ -328,7 +328,7 @@
       SimpleWaitIOCallback waitCallback = new SimpleWaitIOCallback();
       afterCompleteOperations(waitCallback);
       completeOperations();
-      if (timeout <= 0)
+      if (timeout == 0)
       {
          waitCallback.waitCompletion();
       }

Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java	2009-12-03 16:16:23 UTC (rev 8531)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java	2009-12-03 16:26:48 UTC (rev 8532)
@@ -666,8 +666,6 @@
    
          tx.commit();
       }
-      
-      storageManager.waitOnOperations(-1);
 
       return count;
    }



More information about the hornetq-commits mailing list