You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Victor <dr...@mail333.com> on 2009/06/30 19:23:21 UTC
JMX: show workQueue size in ExecutorFilter / thread pool
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