Forums Register Login

ExecutorService Internal queue problem

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
[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.
+Pie Number of slices to send: Send
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.

Praveen
no wonder he is so sad, he hasn't seen this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2622 times.
Similar Threads
Servlet Lifecycle
CorePoolSizeVsMaxPoolSizeVsQueueSize
Design for high throughput
wait and sleep
messages retained by brocker even after client consumes them
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:28:29.