You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2009/12/03 13:12:38 UTC
svn commit: r886751 - in /activemq/trunk/activemq-pool/src/test:
java/org/apache/activemq/usecases/ConsumerThread.java
java/org/apache/activemq/usecases/JDBCSpringTest.java
java/org/apache/activemq/usecases/ProducerThread.java
resources/log4j.properties
Author: dejanb
Date: Thu Dec 3 12:12:37 2009
New Revision: 886751
URL: http://svn.apache.org/viewvc?rev=886751&view=rev
Log:
investigating JDBCSpringTest intermittent failures
Modified:
activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ConsumerThread.java
activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/JDBCSpringTest.java
activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ProducerThread.java
activemq/trunk/activemq-pool/src/test/resources/log4j.properties
Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ConsumerThread.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ConsumerThread.java?rev=886751&r1=886750&r2=886751&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ConsumerThread.java (original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ConsumerThread.java Thu Dec 3 12:12:37 2009
@@ -53,7 +53,7 @@
while (run) {
try {
- Thread.sleep(3000);
+ Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -66,7 +66,7 @@
((SingleConnectionFactory)connectionFactory).destroy();
}
- log.info("ConsumerThread1 closing down");
+ log.info("ConsumerThread closing down");
}
private DefaultMessageListenerContainer createContainer() {
@@ -82,18 +82,6 @@
container.setConcurrentConsumers(concurrentConsumers);
container.setSessionTransacted(sessionTransacted);
- //container.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
- //container.setMaxConcurrentConsumers(concurrentConsumers);
- //container.setAcceptMessagesWhileStopping(false);
- //container.setAutoStartup(false);
- //without setting a tx manager, this will use local JMS tx.
-
- /*
- if (durable) {
- container.setSubscriptionDurable(true);
- container.setDurableSubscriptionName("ConsumerThread1" + Thread.currentThread().getId());
- }
- */
container.afterPropertiesSet();
log.info("subscribing to " + destination + queueSuffix);
return container;
Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/JDBCSpringTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/JDBCSpringTest.java?rev=886751&r1=886750&r2=886751&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/JDBCSpringTest.java (original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/JDBCSpringTest.java Thu Dec 3 12:12:37 2009
@@ -88,7 +88,7 @@
thread.setNumberOfQueues(numberOfQueues);
thread.setQueuePrefix("AMQ-2436.queue.");
thread.setConnectionFactory(connectionFactory);
- thread.setSendDelay(100);
+ //thread.setSendDelay(100);
ProducerThreads.add(thread);
}
@@ -106,13 +106,7 @@
thread.setConsumerName("consumer" + i);
ConsumerThreads.add(thread);
thread.start();
-
- while (!thread.isRunning()) {
- Thread.sleep(200);
- }
- }
-
- Thread.sleep(5000);
+ }
for (ProducerThread thread : ProducerThreads) {
@@ -120,12 +114,10 @@
}
boolean finished = false;
- int retry = 0;
int previous = 0;
while (!finished) {
int totalMessages = 0;
- retry++;
for (Thread thread : ConsumerThreads) {
totalMessages += ((ConsumerThread)thread).getMessageDrivenPojo().getMessageCount();
}
@@ -134,7 +126,6 @@
for (Thread thread : ConsumerThreads) {
((ConsumerThread)thread).setRun(false);
}
- Thread.sleep(3000);
fail("Received " + totalMessages + ", expected " + (numberOfMessages * numberOfProducerThreads));
}
previous = totalMessages;
@@ -151,7 +142,7 @@
}
} else {
- Thread.sleep(10000);
+ Thread.sleep(1000);
}
}
}
Modified: activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ProducerThread.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ProducerThread.java?rev=886751&r1=886750&r2=886751&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ProducerThread.java (original)
+++ activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/usecases/ProducerThread.java Thu Dec 3 12:12:37 2009
@@ -34,7 +34,7 @@
private int numberOfTopics;
private int numberOfMessagesToSend;
private int messagesSent;
- private Random generator = new Random();
+ private Random generator;
private String queuePrefix;
private ConnectionFactory connectionFactory;
private String message;
@@ -45,6 +45,7 @@
@Override
public void run() {
initialize();
+ Random generator = new Random(Thread.currentThread().getName().hashCode());
while (messagesSent < numberOfMessagesToSend) {
int queueSuffix = generator.nextInt(numberOfTopics);
Modified: activemq/trunk/activemq-pool/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/resources/log4j.properties?rev=886751&r1=886750&r2=886751&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/test/resources/log4j.properties (original)
+++ activemq/trunk/activemq-pool/src/test/resources/log4j.properties Thu Dec 3 12:12:37 2009
@@ -21,6 +21,8 @@
log4j.rootLogger=INFO, out, stdout
log4j.logger.org.apache.activemq.spring=WARN
+#log4j.logger.org.apache.activemq.usecases=DEBUG
+#log4j.logger.org.apache.activemq.broker.region=DEBUG
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender