[jboss-cvs] JBoss Messaging SVN: r5715 - in trunk: tests/src/org/jboss/messaging/tests/integration/chunkmessage and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 23 19:28:14 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-01-23 19:28:14 -0500 (Fri, 23 Jan 2009)
New Revision: 5715

Modified:
   trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
   trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
Log:
https://jira.jboss.org/jira/browse/JBMESSAGING-1472 - Fix on MessageChunkTest for pre-ACKs and large-message

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java	2009-01-23 23:48:02 UTC (rev 5714)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java	2009-01-24 00:28:14 UTC (rev 5715)
@@ -631,6 +631,12 @@
 
          if (preAcknowledge)
          {
+            if (message.isLargeMessage())
+            {
+               // we must hold one reference, or the file will be deleted before it could be delivered
+               message.incrementRefCount();
+            }
+            
             // With pre-ack, we ack *before* sending to the client
             ref.getQueue().acknowledge(ref);
          }
@@ -879,6 +885,26 @@
                trace("Finished deliverLargeMessage isBackup = " + messageQueue.isBackup());
             }
 
+            // we must hold one reference, or the file will be deleted before it could be delivered
+            if (preAcknowledge)
+            {
+               if (pendingLargeMessage.decrementRefCount() == 0)
+               {
+                  // On pre-acks for Large messages, the decrement was deferred to large-message, hence we need to 
+                  // subtract the size inside largeMessage
+                  try
+                  {
+                     PagingStore store = pagingManager.getPageStore(bindingAddress);
+                     store.addSize(-pendingLargeMessage.getMemoryEstimate());
+                  }
+                  catch (Exception e)
+                  {
+                     // This shouldn't happen on getPageStore
+                     log.error("Error getting pageStore", e);
+                  }
+               }
+            }
+
             pendingLargeMessage.releaseResources();
 
             largeMessageDeliverer = null;

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java	2009-01-23 23:48:02 UTC (rev 5714)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java	2009-01-24 00:28:14 UTC (rev 5715)
@@ -293,11 +293,10 @@
       testChunks(true, false, false, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
    }
 
-   // Uncomment when https://jira.jboss.org/jira/browse/JBMESSAGING-1472 is complete
-   // public void testMessageChunkFilePersistenceBlockedPreCommit() throws Exception
-   // {
-   // testChunks(true, false, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
-   // }
+   public void testMessageChunkFilePersistenceBlockedPreCommit() throws Exception
+   {
+      testChunks(true, false, true, true, 100, 262144, RECEIVE_WAIT_TIME, 0);
+   }
 
    public void testMessageChunkFilePersistenceDelayed() throws Exception
    {




More information about the jboss-cvs-commits mailing list