Skip to content

Commit

Permalink
Fixed TransactionHealthTest
Browse files Browse the repository at this point in the history
  • Loading branch information
purplefox committed Dec 6, 2009
1 parent fd2e308 commit 86b493a
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.journal.Journal;
import org.hornetq.core.journal.LoaderCallback;
import org.hornetq.core.journal.PreparedTransactionInfo;
import org.hornetq.core.journal.RecordInfo;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.journal.impl.JournalImpl;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.tests.util.SpawnedVMSupport;
import org.hornetq.tests.util.UnitTestCase;

Expand All @@ -42,6 +44,9 @@ public class ValidateTransactionHealthTest extends UnitTestCase

// Constants -----------------------------------------------------

private static final Logger log = Logger.getLogger(ValidateTransactionHealthTest.class);


// Attributes ----------------------------------------------------

private static final int OK = 10;
Expand Down Expand Up @@ -114,8 +119,6 @@ public void testNIO2NonTransactional() throws Exception
internalTest("nio2", getTestDir(), 10000, 0, true, true, 1);
}



// Package protected ---------------------------------------------

// Protected -----------------------------------------------------
Expand Down Expand Up @@ -297,7 +300,9 @@ public static void main(String args[]) throws Exception

try
{
appendData(journalType, journalDir, numberOfElements, transactionSize, numberOfThreads);
Journal journal = appendData(journalType, journalDir, numberOfElements, transactionSize, numberOfThreads);

journal.stop();

}
catch (Exception e)
Expand Down Expand Up @@ -342,17 +347,17 @@ public void failedTransaction(long transactionID, List<RecordInfo> records, List
}
});

LocalThreads threads[] = new LocalThreads[numberOfThreads];
LocalThread threads[] = new LocalThread[numberOfThreads];
final AtomicLong sequenceTransaction = new AtomicLong();

for (int i = 0; i < numberOfThreads; i++)
{
threads[i] = new LocalThreads(journal, numberOfElements, transactionSize, sequenceTransaction);
threads[i] = new LocalThread(journal, numberOfElements, transactionSize, sequenceTransaction);
threads[i].start();
}

Exception e = null;
for (LocalThreads t : threads)
for (LocalThread t : threads)
{
t.join();

Expand Down Expand Up @@ -403,7 +408,7 @@ public static SequentialFileFactory getFactory(String factoryType, String direct
}
}

static class LocalThreads extends Thread
static class LocalThread extends Thread
{
final JournalImpl journal;

Expand All @@ -415,7 +420,7 @@ static class LocalThreads extends Thread

Exception e;

public LocalThreads(JournalImpl journal, long numberOfElements, int transactionSize, AtomicLong nextID)
public LocalThread(JournalImpl journal, long numberOfElements, int transactionSize, AtomicLong nextID)
{
super();
this.journal = journal;
Expand Down

0 comments on commit 86b493a

Please sign in to comment.