[hornetq-commits] JBoss hornetq SVN: r9516 - trunk/tests/src/org/hornetq/tests/stress/journal.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Aug 9 10:42:28 EDT 2010
Author: clebert.suconic at jboss.com
Date: 2010-08-09 10:42:28 -0400 (Mon, 09 Aug 2010)
New Revision: 9516
Modified:
trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java
Log:
The test could hang if the maxRecords Semaphore was not cleared after setting running=false
Modified: trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java 2010-08-06 16:58:45 UTC (rev 9515)
+++ trunk/tests/src/org/hornetq/tests/stress/journal/JournalCleanupCompactStressTest.java 2010-08-09 14:42:28 UTC (rev 9516)
@@ -53,6 +53,8 @@
public static SimpleIDGenerator idGen = new SimpleIDGenerator(1);
+
+ private static final int MAX_WRITES = 20000;
// We want to maximize the difference between appends and deles, or we could get out of memory
public Semaphore maxRecords;
@@ -81,7 +83,7 @@
{
super.setUp();
- maxRecords = new Semaphore(20000);
+ maxRecords = new Semaphore(MAX_WRITES);
errors.set(0);
@@ -103,7 +105,7 @@
}
journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
- 10,
+ 20,
15,
ConfigurationImpl.DEFAULT_JOURNAL_COMPACT_PERCENTAGE,
factory,
@@ -180,6 +182,10 @@
running = false;
+ // Release Semaphore after setting running to false or the threads may never finish
+ maxRecords.release(MAX_WRITES - maxRecords.availablePermits());
+
+
for (Thread t : appenders)
{
t.join();
More information about the hornetq-commits
mailing list