I did have these lines in main. producerThread.join(); consumerThread.join();
and in run() in Consumer.cpp, I have latch.countDown(); and in onMessage() in Consumer.cpp, I have doneLatch.countDown(); Am I doing right ? But I am having a problem to understand what they are for. I made a mistake on my code, so after fixing, I got about 45000 message, and then JVM exited out. The activemq.log is in below. Can you see anything wrong ? Thank you. -------------------------------------------------------- 2015-09-28 19:09:01,412 | INFO | queue://Consumer.B.VirtualTopic.TestDestination purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:01,414 | INFO | queue://testBasics1 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,649 | INFO | queue://TEST.FOO purged of 47217 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,651 | INFO | queue://testSessionCommitAfterConsumerClosed purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,653 | INFO | queue://testSend1 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,655 | INFO | queue://Consumer.A.VirtualTopic.TestDestination purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,656 | INFO | queue://testReceive1 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,660 | INFO | queue://Queue-1438296202694 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,663 | INFO | queue://CmsSendWithAsyncCallbackTest purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,665 | INFO | queue://Queue-1438296199638 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,667 | INFO | queue://ActiveMQ.DLQ purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 2015-09-28 19:09:04,669 | INFO | queue://Queue-1438296198618 purged of 0 messages | org.apache.activemq.broker.region.Queue | RMI TCP Connection(8)-130.20.132.42 On Mon, Sep 28, 2015 at 7:05 PM, Tim Bain <tb...@alumni.duke.edu> wrote: > Is the producer your last non-daemon thread? If so, the JVM will exit when > that thread exits, but you could use a synchronization construct such as a > countdown latch or a call to Thread.join() to make the producer thread not > exit till the consumer does. > On Sep 28, 2015 7:21 PM, "mfan" <chaome...@gmail.com> wrote: > > > I am trying to write an application that a producer (with PERSISTENT > > delivery > > mode) sends 80000 messages to asynchronous a consumer. Both producer and > > consumer are in acknowledgement mode (AUTO_ACKNOWLEDGE). After the > > consumer > > received a message, it will do some work. Somehow the producer producing > > message faster than consumer did the work, and right after the producer > > finished sending it's last message, both consumer called destructor > > automatically. How to let the consumer continuously getting the message > > and > > do the computation ? I search online and found maybe due to the > > memoryLimit. So I check the activemq.xml file in > > '/home/apache-activemq-5.11.1/data/' directory, I copied partial related > to > > memory paragraph in below which I do not quite understand, I need help to > > make sure the memory was not the issue. If that is true, what else > problem > > could be ? Thank you for helping. > > > > > > Store limit is 102400 mb (current store usage is 72 mb). The data > > directory: > > /home/apache-activemq-5.11.1/data/kahadb only has 12918 mb of usable > space > > - > > resetting to maximum available disk space: 12990 mb | > > org.apache.activemq.broker.BrokerService | main > > 2015-09-28 17:25:08,460 | WARN | Temporary Store limit is 51200 mb, > whilst > > the temporary data directory: > > /home/apache-activemq-5.11.1/data/localhost/tmp_storage only has 12918 mb > > of > > usable space - resetting to maximum available 12918 mb. | > > org.apache.activemq.broker.BrokerService | main > > > > > > > > -- > > View this message in context: > > > http://activemq.2283324.n4.nabble.com/The-consumer-thread-closed-right-after-producer-thread-finishes-sending-messages-tp4702393.html > > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > >