From e5147d0df8b76db94059a442cfbe40cbce22d79f Mon Sep 17 00:00:00 2001 From: Robert Greig Date: Tue, 16 Jan 2007 19:38:51 +0000 Subject: Fix to broken build due to missing file. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@496833 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/util/concurrent/BooleanLatch.java | 42 ++++++++++++++++++++++ java/perftests/pom.xml | 1 + .../apache/qpid/requestreply/PingPongProducer.java | 21 +++++------ 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 java/common/src/main/java/org/apache/qpid/util/concurrent/BooleanLatch.java (limited to 'java') 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 @@ org.apache.maven.plugins maven-assembly-plugin + ${assembly.version} jar-with-dependencies.xml 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); + } } } -- cgit v1.2.1