I am running in to a problem with java.util.concurrent.ExecutorService's internal queue. I have a producer producing messages in to activemq queue and consumer consuming the messages. The consumer uses ExecutosService thread pooling. The consumer submits the consumed job to thread pool, and if all the threads are busy, the job gets queued in the thread pool internal queue. The issue with this is i want to monitor the activemq to see how many are waiting to be processed. I do not want the thread pool to push jobs in in its internal queue. Its very to hard to say which jobs are waiting to be processed as i cannot monitor the thread pools internal queue.
Has anyone encountered such an issue?
Thank you Praveen [ November 15, 2006: Message edited by: praveen neppalli naga ]
[praveen] :Its very to hard to say which jobs are waiting to be processed as i cannot monitor the thread pools internal queue.
You could use one of the ThreadPoolExecutor constructors that allows you to provide your own BlockingQueue as the pool's work queue. That way you have a reference to the queue, and can call size() to discover how may tasks are in the queue at a given time.
"I'm not back." - Bill Harding, Twister
praveen neppalli naga
Joined: Feb 27, 2006
Thanks for the reply Jim, Ok that will allow me to see the jobs pending in the queue. But i would be happy to see the activemq queue since it is a persistant one and i can look in to a database table to see what jobs are pending. Now wat happens is i look in to the database table for that queue and see its empty which made me assume that everything is processed. But i digged deep to see those jobs sitting in thread pool internal queue. Just wondering if there will be any way to maintain the unprocessed jobs in activemq rather than threadpool queue.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com