[hornetq-commits] JBoss hornetq SVN: r9793 - in branches/Branch_New_Paging: tests/src/org/hornetq/tests/integration/paging and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 15 16:19:00 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-10-15 16:18:59 -0400 (Fri, 15 Oct 2010)
New Revision: 9793

Modified:
   branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
   branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
Log:
Transactions on Cursors

Modified: branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
--- branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java	2010-10-15 20:07:39 UTC (rev 9792)
+++ branches/Branch_New_Paging/src/main/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java	2010-10-15 20:18:59 UTC (rev 9793)
@@ -207,6 +207,14 @@
    {
       rolledback = true;
       committed = false;
+
+      if (lateDeliveries != null)
+      {
+         for (Pair<PageCursor, PagePosition> pos : lateDeliveries)
+         {
+            pos.a.positionIgnored(pos.b);
+         }
+      }
    }
 
    public String toString()

Modified: branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
===================================================================
--- branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java	2010-10-15 20:07:39 UTC (rev 9792)
+++ branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java	2010-10-15 20:18:59 UTC (rev 9793)
@@ -381,9 +381,9 @@
       
       PageCursorProvider cursorProvider = this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier();
       System.out.println("cursorProvider = " + cursorProvider);
+       
+      PageCursor cursor = pageStore.getCursorProvier().getCursor(queue.getID());
       
-      PageCursor cursor = this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier().getCursor(queue.getID());
-      
       System.out.println("Cursor: " + cursor);
       
       StorageManager storage = this.server.getStorageManager();
@@ -392,14 +392,20 @@
       PageTransactionInfoImpl pgtxForgotten = new PageTransactionInfoImpl(storage.generateUniqueID());
       PageTransactionInfoImpl pgtxCommit = new PageTransactionInfoImpl(storage.generateUniqueID());
       
+      System.out.println("Forgetting tx " + pgtxForgotten.getTransactionID());
+      
       this.server.getPagingManager().addTransaction(pgtxRollback);
       this.server.getPagingManager().addTransaction(pgtxCommit);
       
       pgMessages(storage, pageStore, pgtxRollback, 0, NUM_MESSAGES, messageSize);
+      pageStore.forceAnotherPage();
       pgMessages(storage, pageStore, pgtxForgotten, 100, NUM_MESSAGES, messageSize);
+      pageStore.forceAnotherPage();
       pgMessages(storage, pageStore, pgtxCommit, 200, NUM_MESSAGES, messageSize);
+      pageStore.forceAnotherPage();
       
       addMessages(300, NUM_MESSAGES, messageSize);
+      pageStore.forceAnotherPage();
 
 
       // First consume what's already there without any tx as nothing was committed
@@ -414,6 +420,7 @@
       assertNull(cursor.moveNext());
       
       pgtxRollback.rollback();
+      this.server.getPagingManager().removeTransaction(pgtxRollback.getTransactionID());
       pgtxCommit.commit();
       // Second:after pgtxCommit was done
       for (int i = 200; i < 300; i++)



More information about the hornetq-commits mailing list