Hello,

I think it may be useful to add some info about working queue to JMX.
Currently, we can see how many threads are working, but can not see queue size.

First, I tried to add it to ObjectMBean... without success,
but then I added the following method to ExecutorFilter and it works:

public int getWorkQueueSize() {
        if (executor instanceof ThreadPoolExecutor) {
                return ((ThreadPoolExecutor)executor).getQueue().size();
        }
        return 0;
    }

If you want it working with OrderedThreadPoolExecutor, you should also comment OrderedThreadPoolExecutor.getQueue() method (which throws UnsupportedOperationException). But seems that OrderedThreadPoolExecutor has its specific implementation and ignores workQueue.

Victor N

Reply via email to