[jboss-cvs] JBoss Messaging SVN: r7585 - in trunk: tests/src/org/jboss/messaging/tests/stress/journal and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 17 11:58:37 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-07-17 11:58:37 -0400 (Fri, 17 Jul 2009)
New Revision: 7585
Modified:
trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
trunk/tests/src/org/jboss/messaging/tests/stress/journal/LargeJournalStressTest.java
Log:
just tweaks
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-07-17 15:36:55 UTC (rev 7584)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-07-17 15:58:37 UTC (rev 7585)
@@ -211,7 +211,7 @@
private volatile JournalCompactor compactor;
// Latch used to wait compactor finish, to make sure we won't stop the journal with the compactor running
- private final VariableLatch compactorWait = new VariableLatch();
+ private final AtomicBoolean compactorRunning = new AtomicBoolean();
private ExecutorService filesExecutor = null;
@@ -1402,6 +1402,7 @@
/**
*
* Note: This method can't be called from the main executor, as it will invoke other methods depending on it.
+ *
*/
public synchronized void compact() throws Exception
{
@@ -2058,7 +2059,7 @@
long compactMargin = (long)(totalBytes * compactPercentage);
- if (totalLiveSize < compactMargin && compactorWait.getCount() == 0 && dataFiles.length > compactMinFiles)
+ if (totalLiveSize < compactMargin && !compactorRunning.get() && dataFiles.length > compactMinFiles)
{
log.info("Compacting being started, numberOfDataFiles = " + dataFiles.length +
@@ -2067,10 +2068,11 @@
", margin to start compacting = " +
compactMargin);
- compactorWait.waitCompletion();
+ if (!compactorRunning.compareAndSet(false, true))
+ {
+ return;
+ }
- compactorWait.up();
-
// We can't use the executor for the compacting... or we would lock files opening and creation (besides other
// operations)
// that would freeze the journal while compacting
@@ -2089,7 +2091,7 @@
}
finally
{
- compactorWait.down();
+ compactorRunning.set(false);
}
}
};
@@ -2162,8 +2164,6 @@
* It will call waitComplete on every transaction, so any assertions on the file system will be correct after this */
public void debugWait() throws Exception
{
- compactorWait.waitCompletion();
-
fileFactory.testFlush();
for (JournalTransaction tx : transactions.values())
Modified: trunk/tests/src/org/jboss/messaging/tests/stress/journal/LargeJournalStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/journal/LargeJournalStressTest.java 2009-07-17 15:36:55 UTC (rev 7584)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/journal/LargeJournalStressTest.java 2009-07-17 15:58:37 UTC (rev 7585)
@@ -22,8 +22,6 @@
package org.jboss.messaging.tests.stress.journal;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
More information about the jboss-cvs-commits
mailing list