don't wait for ever to stop

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@585215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-10-16 18:25:17 +00:00
parent 9da7e31a33
commit 4c137cd2bc
1 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,7 @@
package org.apache.activemq.perf;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.jms.BytesMessage;
import javax.jms.Connection;
@ -62,7 +63,9 @@ public class PerfProducer implements Runnable {
rate.reset();
running = true;
connection.start();
new Thread(this).start();
Thread t = new Thread(this);
t.setName("Producer");
t.start();
}
}
@ -70,7 +73,7 @@ public class PerfProducer implements Runnable {
synchronized (this) {
running = false;
}
stopped.await();
stopped.await(1,TimeUnit.SECONDS);
connection.stop();
}