diff options
Diffstat (limited to 'java')
3 files changed, 54 insertions, 10 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/util/concurrent/BooleanLatch.java b/java/common/src/main/java/org/apache/qpid/util/concurrent/BooleanLatch.java new file mode 100644 index 0000000000..70a5f2dc5e --- /dev/null +++ b/java/common/src/main/java/org/apache/qpid/util/concurrent/BooleanLatch.java @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.qpid.util.concurrent; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/** + * @author Apache Software Foundation + */ +public class BooleanLatch extends CountDownLatch +{ + public BooleanLatch() + { + super(1); + } + + public void signal() + { + countDown(); + } + + public void await(long nanos) throws InterruptedException + { + await(nanos, TimeUnit.NANOSECONDS); + } +} diff --git a/java/perftests/pom.xml b/java/perftests/pom.xml index 874cbd3e52..2f79654e6a 100644 --- a/java/perftests/pom.xml +++ b/java/perftests/pom.xml @@ -146,6 +146,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> + <version>${assembly.version}</version> <configuration> <descriptors> <descriptor>jar-with-dependencies.xml</descriptor> 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 8bb2da8b6f..c1d42eeed4 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 @@ -20,23 +20,19 @@ */
package org.apache.qpid.requestreply;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jms.*;
-
import org.apache.log4j.Logger;
-
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQNoConsumersException;
import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.message.TestMessageFactory;
import org.apache.qpid.jms.MessageProducer;
import org.apache.qpid.jms.Session;
import org.apache.qpid.ping.AbstractPingProducer;
import org.apache.qpid.util.concurrent.BooleanLatch;
+import javax.jms.*;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* PingPongProducer is a client that sends pings to a queue and waits for pongs to be bounced back by a bounce back
* client (see {@link org.apache.qpid.requestreply.PingPongClient} for the bounce back client). It is designed to be run from the command line
@@ -238,7 +234,7 @@ public class PingPongProducer extends AbstractPingProducer implements Runnable, *
* @throws JMSException All underlying JMSExceptions are allowed to fall through.
*/
- public Message pingAndWaitForReply(Message message, long timeout) throws JMSException
+ public Message pingAndWaitForReply(Message message, long timeout) throws JMSException, InterruptedException
{
_producer.send(message);
@@ -297,5 +293,10 @@ public class PingPongProducer extends AbstractPingProducer implements Runnable, _publish = false;
_logger.debug("There was a JMSException: " + e.getMessage(), e);
}
+ catch (InterruptedException e)
+ {
+ _publish = false;
+ _logger.debug("There was an interruption: " + e.getMessage(), e);
+ }
}
}
|