Author: borges
Date: 2011-09-07 12:08:41 -0400 (Wed, 07 Sep 2011)
New Revision: 11301
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/PageTransactionInfo.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
clean up
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/PageTransactionInfo.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/PageTransactionInfo.java 2011-09-07
14:16:34 UTC (rev 11300)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/PageTransactionInfo.java 2011-09-07
16:08:41 UTC (rev 11301)
@@ -14,8 +14,8 @@
package org.hornetq.core.paging;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.paging.cursor.PageSubscription;
import org.hornetq.core.paging.cursor.PagePosition;
+import org.hornetq.core.paging.cursor.PageSubscription;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.transaction.Transaction;
@@ -26,10 +26,6 @@
*/
public interface PageTransactionInfo extends EncodingSupport
{
- boolean isCommit();
-
- boolean isRollback();
-
void setCommitted(boolean committed);
void commit();
@@ -48,13 +44,9 @@
void reloadUpdate(final StorageManager storageManager, final PagingManager
pagingManager, final Transaction tx, final int increment) throws Exception;
- void storeUpdate(StorageManager storageManager, PagingManager pagingManager) throws
Exception;
-
// To be used after the update was stored or reload
void onUpdate(int update, StorageManager storageManager, PagingManager
pagingManager);
- void increment();
-
void increment(int size);
int getNumberOfMessages();
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2011-09-07
14:16:34 UTC (rev 11300)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2011-09-07
16:08:41 UTC (rev 11301)
@@ -21,14 +21,12 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Pair;
-import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.paging.PageTransactionInfo;
import org.hornetq.core.paging.PagingManager;
import org.hornetq.core.paging.cursor.PagePosition;
import org.hornetq.core.paging.cursor.PageSubscription;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.server.MessageReference;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.TransactionOperationAbstract;
import org.hornetq.core.transaction.TransactionPropertyIndexes;
@@ -57,7 +55,7 @@
private volatile boolean rolledback = false;
- private AtomicInteger numberOfMessages = new AtomicInteger(0);
+ private final AtomicInteger numberOfMessages = new AtomicInteger(0);
private List<Pair<PageSubscription, PagePosition>> lateDeliveries;
@@ -109,11 +107,6 @@
pagingManager.removeTransaction(this.transactionID);
}
}
-
- public void increment()
- {
- numberOfMessages.incrementAndGet();
- }
public void increment(final int size)
{
@@ -207,44 +200,11 @@
return pgtxUpdate;
}
- public void storeUpdate(final StorageManager storageManager, final PagingManager
pagingManager) throws Exception
- {
- storageManager.updatePageTransaction(this, 1);
- storageManager.afterCompleteOperations(new IOAsyncTask()
- {
- public void onError(int errorCode, String errorMessage)
- {
- }
-
- public void done()
- {
- PageTransactionInfoImpl.this.onUpdate(1, storageManager, pagingManager);
- }
-
- public List<MessageReference> getRelatedMessageReferences()
- {
- return null;
- }
- });
- }
-
-
-
- public boolean isCommit()
- {
- return committed;
- }
-
public void setCommitted(final boolean committed)
{
this.committed = committed;
}
- public boolean isRollback()
- {
- return rolledback;
- }
-
public synchronized void rollback()
{
rolledback = true;
@@ -260,6 +220,7 @@
}
}
+ @Override
public String toString()
{
return "PageTransactionInfoImpl(transactionID=" + transactionID +
@@ -316,7 +277,7 @@
static class UpdatePageTXOperation extends TransactionOperationAbstract
{
- private HashMap<PageTransactionInfo, AtomicInteger> countsToUpdate = new
HashMap<PageTransactionInfo, AtomicInteger>();
+ private final HashMap<PageTransactionInfo, AtomicInteger> countsToUpdate =
new HashMap<PageTransactionInfo, AtomicInteger>();
private boolean stored = false;
@@ -348,16 +309,19 @@
counter.addAndGet(increment);
}
+ @Override
public void beforePrepare(Transaction tx) throws Exception
{
storeUpdates(tx);
}
+ @Override
public void beforeCommit(Transaction tx) throws Exception
{
storeUpdates(tx);
}
+ @Override
public void afterCommit(Transaction tx)
{
for (Map.Entry<PageTransactionInfo, AtomicInteger> entry :
countsToUpdate.entrySet())
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java 2011-09-07
14:16:34 UTC (rev 11300)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java 2011-09-07
16:08:41 UTC (rev 11301)
@@ -38,8 +38,6 @@
createProducerSendSomeMessages();
startBackupFinishSyncing();
File dir = new
File(backupServer.getServer().getConfiguration().getLargeMessagesDirectory());
- System.out.println("Dir " + dir.getAbsolutePath() + " " +
dir.exists());
- // Set<Long> idsOnBkp = getAllMessageFileIds(dir);
receiveMsgsInRange(0, n_msgs / 2);
assertEquals("we really ought to delete these after delivery", n_msgs /
2, getAllMessageFileIds(dir).size());
}
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java 2011-09-07
14:16:34 UTC (rev 11300)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedPagingFailoverTest.java 2011-09-07
16:08:41 UTC (rev 11301)
@@ -13,9 +13,6 @@
package org.hornetq.tests.integration.cluster.failover;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
-import org.hornetq.tests.integration.cluster.util.TestableServer;
/**
* A ReplicatedPagingFailoverTest
Modified:
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-09-07
14:16:34 UTC (rev 11300)
+++
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-09-07
16:08:41 UTC (rev 11301)
@@ -91,7 +91,7 @@
for (int i = 0; i < nr1; i++)
{
- trans.increment();
+ trans.increment(1);
}
Assert.assertEquals(nr1, trans.getNumberOfMessages());