git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1074285 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-02-24 20:12:13 +00:00
parent 6595dc4a62
commit d245457ccd
1 changed files with 6 additions and 2 deletions

View File

@ -160,7 +160,9 @@ public class JmsConsumerClient extends AbstractJmsMeasurableClient {
public void onMessage(Message msg) {
incThroughput();
recvCount.incrementAndGet();
recvCount.notify();
synchronized (recvCount) {
recvCount.notify();
}
}
});
@ -169,7 +171,9 @@ public class JmsConsumerClient extends AbstractJmsMeasurableClient {
LOG.info("Starting to asynchronously receive " + client.getRecvCount() + " messages...");
try {
while (recvCount.get() < count) {
recvCount.wait();
synchronized (recvCount) {
recvCount.wait();
}
}
} catch (InterruptedException e) {
throw new JMSException("JMS consumer thread wait has been interrupted. Message: " + e.getMessage());