Author: clebert.suconic(a)jboss.com
Date: 2009-12-01 17:43:53 -0500 (Tue, 01 Dec 2009)
New Revision: 8485
Modified:
trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/tests/src/org/hornetq/tests/stress/client/SendStressTest.java
trunk/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
Log:
Fixing stress tests
Modified: trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2009-12-01 20:38:26
UTC (rev 8484)
+++ trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2009-12-01 22:43:53
UTC (rev 8485)
@@ -17,7 +17,9 @@
import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -398,6 +400,21 @@
if (running)
{
running = false;
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ executor.execute(new Runnable()
+ {
+ public void run()
+ {
+ latch.countDown();
+ }
+ });
+
+ if (!latch.await(60, TimeUnit.SECONDS))
+ {
+ log.warn("Timed out on waiting PagingStore " + this.address +
" to shutdown");
+ }
if (currentPage != null)
{
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-12-01 20:38:26
UTC (rev 8484)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-12-01 22:43:53
UTC (rev 8485)
@@ -385,6 +385,11 @@
managementService.stop();
+ if (pagingManager != null)
+ {
+ pagingManager.stop();
+ }
+
if (storageManager != null)
{
storageManager.stop();
@@ -423,8 +428,6 @@
postOffice.stop();
}
- // Need to shutdown pools before shutting down paging manager to make sure
everything is written ok
-
List<Runnable> tasks = scheduledPool.shutdownNow();
for (Runnable task : tasks)
@@ -436,11 +439,6 @@
scheduledPool = null;
- if (pagingManager != null)
- {
- pagingManager.stop();
- }
-
if (memoryManager != null)
{
memoryManager.stop();
Modified: trunk/tests/src/org/hornetq/tests/stress/client/SendStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/client/SendStressTest.java 2009-12-01
20:38:26 UTC (rev 8484)
+++ trunk/tests/src/org/hornetq/tests/stress/client/SendStressTest.java 2009-12-01
22:43:53 UTC (rev 8485)
@@ -13,8 +13,6 @@
package org.hornetq.tests.stress.client;
-import junit.framework.TestSuite;
-
import org.hornetq.core.client.ClientConsumer;
import org.hornetq.core.client.ClientMessage;
import org.hornetq.core.client.ClientProducer;
@@ -44,11 +42,6 @@
// Public --------------------------------------------------------
// Remove this method to re-enable those tests
- public static TestSuite suite()
- {
- return new TestSuite();
- }
-
public void testStressSendNetty() throws Exception
{
doTestStressSend(true);
Modified: trunk/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java 2009-12-01
20:38:26 UTC (rev 8484)
+++
trunk/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java 2009-12-01
22:43:53 UTC (rev 8485)
@@ -16,7 +16,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
-import org.hornetq.core.buffers.HornetQBuffers;
import org.hornetq.core.client.ClientConsumer;
import org.hornetq.core.client.ClientMessage;
import org.hornetq.core.client.ClientProducer;
Modified:
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2009-12-01
20:38:26 UTC (rev 8484)
+++
trunk/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2009-12-01
22:43:53 UTC (rev 8485)
@@ -16,8 +16,11 @@
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
-import org.hornetq.core.buffers.HornetQBuffers;
-import org.hornetq.core.client.*;
+import org.hornetq.core.client.ClientConsumer;
+import org.hornetq.core.client.ClientMessage;
+import org.hornetq.core.client.ClientProducer;
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.exception.HornetQException;
@@ -28,6 +31,8 @@
/**
* A MultiThreadConsumerStressTest
+ *
+ * This test validates consuming / sending messages while compacting is working
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*
@@ -153,7 +158,6 @@
private void setupServer(JournalType journalType) throws Exception, HornetQException
{
Configuration config = createDefaultConfig(true);
- config.setJournalFileSize(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE);
config.setJournalType(journalType);
config.setJMXManagementEnabled(true);
@@ -169,6 +173,12 @@
server.start();
sf = createNettyFactory();
+
+ sf.setBlockOnPersistentSend(false);
+
+ sf.setBlockOnNonPersistentSend(false);
+
+ sf.setBlockOnAcknowledge(false);
ClientSession sess = sf.createSession();
Modified: trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2009-12-01
20:38:26 UTC (rev 8484)
+++ trunk/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2009-12-01
22:43:53 UTC (rev 8485)
@@ -29,7 +29,7 @@
import org.hornetq.utils.SimpleString;
/**
- * This is an integration-tests that will take some time to run. TODO: Maybe this test
belongs somewhere else?
+ * This is an integration-tests that will take some time to run.
*
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
*/
@@ -51,6 +51,9 @@
public void testStopDuringDepage() throws Exception
{
Configuration config = createDefaultConfig();
+
+ config.setJournalSyncNonTransactional(false);
+ config.setJournalSyncTransactional(false);
HashMap<String, AddressSettings> settings = new HashMap<String,
AddressSettings>();
@@ -63,6 +66,8 @@
ClientSessionFactory factory = createInVMFactory();
factory.setBlockOnAcknowledge(true);
+ factory.setBlockOnPersistentSend(false);
+ factory.setBlockOnNonPersistentSend(false);
ClientSession session = null;
try
@@ -119,7 +124,8 @@
System.out.println("server stopped, nr msgs: " + msgs);
- messagingService = createServer(true, config, 20 * 1024 * 1024, 10 * 1024 *
1024, settings);
+ messagingService = createServer(true, config, 10 * 1024 * 1024, 20 * 1024 *
1024, settings);
+
messagingService.start();
factory = createInVMFactory();
@@ -153,7 +159,13 @@
finally
{
session.close();
- messagingService.stop();
+ try
+ {
+ messagingService.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
}
}