summaryrefslogtreecommitdiff
path: root/java/perftests/src/main
diff options
context:
space:
mode:
authorBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-04-25 14:46:03 +0000
committerBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-04-25 14:46:03 +0000
commit385cc184361c6d58d56fb696e4eeb0f6ad511fa0 (patch)
tree1f6204b12dc0dfee95bfe2844b4e3a2878a39c4d /java/perftests/src/main
parent67e83d69417b33226cf647f4d83bbd6a4bc86ce5 (diff)
downloadqpid-python-385cc184361c6d58d56fb696e4eeb0f6ad511fa0.tar.gz
Made the return type of getTestMessage() to a generic type for subclass to override.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@532372 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/perftests/src/main')
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java18
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java4
2 files changed, 19 insertions, 3 deletions
diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java
index 7cf5e4516f..29757a20ba 100644
--- a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java
+++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java
@@ -6,6 +6,12 @@ import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.qpid.util.CommandLineParser;
+import org.apache.qpid.client.message.TestMessageFactory;
+
+import javax.jms.ObjectMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
/**
* <p><table id="crc"><caption>CRC Card</caption>
@@ -32,7 +38,7 @@ public class PingSendOnlyClient extends PingDurableClient
{
// Create a ping producer overriding its defaults with all options passed on the command line.
Properties options = CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}));
- PingDurableClient pingProducer = new PingSendOnlyClient(options);
+ PingSendOnlyClient pingProducer = new PingSendOnlyClient(options);
// Create a shutdown hook to terminate the ping-pong producer.
Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
@@ -54,4 +60,14 @@ public class PingSendOnlyClient extends PingDurableClient
System.exit(1);
}
}
+
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ {
+ Message msg = TestMessageFactory.newTextMessage(_producerSession, messageSize);
+
+ // Timestamp the message in nanoseconds.
+ msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
+
+ return msg;
+ }
}
diff --git a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
index ecaf27167f..5dec2125ee 100644
--- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
+++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
@@ -1049,7 +1049,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis
try
{
// Generate a sample message and time stamp it.
- ObjectMessage msg = getTestMessage(_replyDestination, _messageSize, _persistent);
+ Message msg = getTestMessage(_replyDestination, _messageSize, _persistent);
msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
// Send the message and wait for a reply.
@@ -1096,7 +1096,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis
*
* @throws javax.jms.JMSException All underlying JMSException are allowed to fall through.
*/
- public ObjectMessage getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
{
ObjectMessage msg = TestMessageFactory.newObjectMessage(_producerSession, replyQueue, messageSize, persistent);