summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-07-04 15:06:27 +0000
committerKeith Wall <kwall@apache.org>2012-07-04 15:06:27 +0000
commit2235c8c39e252f804ba5c79540147d70b8f2d856 (patch)
tree0adf0834b22e3232e8fd55ca69994e7d0a816c53
parente40eb10fcbde6c1227d523befec06a64c4727f5f (diff)
downloadqpid-python-2235c8c39e252f804ba5c79540147d70b8f2d856.tar.gz
QPID-4105: perf test tidy-up code changes:
- Now accessing sessions in a threadsafe manner - Corrected spelling of ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION Applied patch from Philip Harvey <phil@philharveyonline.com> git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1357295 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java8
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java2
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java2
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java89
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java4
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java2
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java4
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java4
8 files changed, 70 insertions, 45 deletions
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java
index 2dcf8940b6..6af1e1316a 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java
@@ -169,8 +169,14 @@ public class MessageProvider
protected Message createTextMessage(Session ssn, final CreateProducerCommand command) throws JMSException
{
String payload = getMessagePayload(command);
- TextMessage msg = ssn.createTextMessage();
+
+ TextMessage msg = null;
+ synchronized(ssn)
+ {
+ msg = ssn.createTextMessage();
+ }
msg.setText(payload);
+
return msg;
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java
index 49f6ae103c..c02c4faed9 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java
@@ -93,7 +93,7 @@ public class ProducerParticipant implements Participant
}
catch (CancellationException ce)
{
- LOGGER.trace("Producer send was cancelled due to maximum duration {} ms", requiredDuration);
+ LOGGER.debug("Producer send was cancelled due to maximum duration {} ms", requiredDuration);
break;
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java
index 7806528a8c..f2369ed671 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java
@@ -37,7 +37,7 @@ public class ProducerConfig extends ParticipantConfig
public ProducerConfig()
{
_deliveryMode = Message.DEFAULT_DELIVERY_MODE;
- _messageSize = 0;
+ _messageSize = 1024;
_priority = Message.DEFAULT_PRIORITY;
_timeToLive = Message.DEFAULT_TIME_TO_LIVE;
_interval = 0;
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java
index 1a0e129c64..f1dd911f0b 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java
@@ -212,30 +212,35 @@ public class ClientJmsDelegate
{
throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
}
- final Destination destination = session.createQueue(command.getDestinationName());
- final MessageProducer jmsProducer = session.createProducer(destination);
- if (command.getPriority() != -1)
- {
- jmsProducer.setPriority(command.getPriority());
- }
- if (command.getTimeToLive() > 0)
- {
- jmsProducer.setTimeToLive(command.getTimeToLive());
- }
- if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT
- || command.getDeliveryMode() == DeliveryMode.PERSISTENT)
+ synchronized(session)
{
- jmsProducer.setDeliveryMode(command.getDeliveryMode());
- }
+ final Destination destination = session.createQueue(command.getDestinationName());
+
+ final MessageProducer jmsProducer = session.createProducer(destination);
+
+ if (command.getPriority() != -1)
+ {
+ jmsProducer.setPriority(command.getPriority());
+ }
+ if (command.getTimeToLive() > 0)
+ {
+ jmsProducer.setTimeToLive(command.getTimeToLive());
+ }
+
+ if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT
+ || command.getDeliveryMode() == DeliveryMode.PERSISTENT)
+ {
+ jmsProducer.setDeliveryMode(command.getDeliveryMode());
+ }
- addProducer(command.getParticipantName(), jmsProducer);
+ addProducer(command.getParticipantName(), jmsProducer);
+ }
}
catch (final JMSException jmse)
{
throw new DistributedTestException("Unable to create new producer: " + command, jmse);
}
-
}
public void createConsumer(final CreateConsumerCommand command)
@@ -247,11 +252,15 @@ public class ClientJmsDelegate
{
throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
}
- final Destination destination = command.isTopic() ? session.createTopic(command.getDestinationName())
- : session.createQueue(command.getDestinationName());
- final MessageConsumer jmsConsumer = session.createConsumer(destination, command.getSelector());
- _testConsumers.put(command.getParticipantName(), jmsConsumer);
+ synchronized(session)
+ {
+ final Destination destination = command.isTopic() ? session.createTopic(command.getDestinationName())
+ : session.createQueue(command.getDestinationName());
+ final MessageConsumer jmsConsumer = session.createConsumer(destination, command.getSelector());
+
+ _testConsumers.put(command.getParticipantName(), jmsConsumer);
+ }
}
catch (final JMSException jmse)
{
@@ -346,7 +355,10 @@ public class ClientJmsDelegate
final Session session = _testSessions.get(sessionName);
if (session.getTransacted())
{
- session.commit();
+ synchronized(session)
+ {
+ session.commit();
+ }
}
else if (message != null && session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
{
@@ -461,13 +473,16 @@ public class ClientJmsDelegate
try
{
final Session session = _testSessions.get(sessionName);
- if (session.getTransacted())
+ synchronized(session)
{
- session.rollback();
- }
- else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
- {
- session.recover();
+ if (session.getTransacted())
+ {
+ session.rollback();
+ }
+ else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
+ {
+ session.recover();
+ }
}
}
catch (final JMSException jmse)
@@ -482,13 +497,16 @@ public class ClientJmsDelegate
try
{
final Session session = _testSessions.get(sessionName);
- if (session.getTransacted())
+ synchronized(session)
{
- session.rollback();
- }
- else
- {
- session.recover();
+ if (session.getTransacted())
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.recover();
+ }
}
}
catch (final JMSException jmse)
@@ -568,15 +586,16 @@ public class ClientJmsDelegate
}
}
+ /** only supports text messages - returns 0 for other message types */
public int calculatePayloadSizeFrom(Message message)
{
try
{
if (message != null && message instanceof TextMessage)
{
- return ((TextMessage) message).getText().getBytes().length;
+ return ((TextMessage) message).getText().getBytes().length;
}
- // TODO support other message types
+
return 0;
}
catch (JMSException e)
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
index 566d4e2076..ad9aa31472 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
@@ -18,7 +18,7 @@
*/
package org.apache.qpid.disttest.message;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
@@ -65,7 +65,7 @@ public class ConsumerParticipantResult extends ParticipantResult
}
- @OutputAttribute(attribute=IS_BROWSIING_SUBSCRIPTION)
+ @OutputAttribute(attribute=IS_BROWSING_SUBSCRIPTION)
public boolean isBrowsingSubscription()
{
return _browsingSubscription;
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java
index 0644ec16a3..0418562a2d 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java
@@ -45,7 +45,7 @@ public enum ParticipantAttribute
PRODUCER_INTERVAL("producerIntervalMs"),
IS_TOPIC("isTopic"),
IS_DURABLE_SUBSCRIPTION("isDurableSubscription"),
- IS_BROWSIING_SUBSCRIPTION("isBrowsingSubscription"),
+ IS_BROWSING_SUBSCRIPTION("isBrowsingSubscription"),
IS_SELECTOR("isSelector"),
IS_NO_LOCAL("isNoLocal"),
IS_SYNCHRONOUS_CONSUMER("isSynchronousConsumer"),
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
index 12731c06f4..34727a7b8d 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
@@ -22,7 +22,7 @@ import static org.apache.qpid.disttest.message.ParticipantAttribute.*;
import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
import static org.apache.qpid.disttest.message.ParticipantAttribute.DELIVERY_MODE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
@@ -127,7 +127,7 @@ public class ParticipantResultTest extends TestCase
assertEquals(topic, result.getAttributes().get(IS_TOPIC));
assertEquals(durable, result.getAttributes().get(IS_DURABLE_SUBSCRIPTION));
- assertEquals(browsingSubscription, result.getAttributes().get(IS_BROWSIING_SUBSCRIPTION));
+ assertEquals(browsingSubscription, result.getAttributes().get(IS_BROWSING_SUBSCRIPTION));
assertEquals(selector, result.getAttributes().get(IS_SELECTOR));
assertEquals(noLocal, result.getAttributes().get(IS_NO_LOCAL));
assertEquals(synchronousConsumer, result.getAttributes().get(IS_SYNCHRONOUS_CONSUMER));
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
index 7c6cfed402..565f59d25b 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
@@ -22,7 +22,7 @@ import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
import static org.apache.qpid.disttest.message.ParticipantAttribute.*;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
@@ -108,7 +108,7 @@ public class CSVFormaterTest extends TestCase
participantAttributes.put(PRODUCER_INTERVAL, 9);
participantAttributes.put(IS_TOPIC, true);
participantAttributes.put(IS_DURABLE_SUBSCRIPTION, false);
- participantAttributes.put(IS_BROWSIING_SUBSCRIPTION, true);
+ participantAttributes.put(IS_BROWSING_SUBSCRIPTION, true);
participantAttributes.put(IS_SELECTOR, false);
participantAttributes.put(IS_NO_LOCAL, true);
participantAttributes.put(IS_SYNCHRONOUS_CONSUMER, false);