On 19/02/2019 08:20, Huxing Zhang wrote: > Hi, > > Currently Tomcat's thread pool implementation, which is under > org.apache.tomcat.util.net.AbstractEndpoint, does not expose task > queue size via JMX, while in > org.apache.catalina.core.StandardThreadExecutor it can be accessed via > JMX. > > The background is that I am involved with a project to auto scale web > application and the size of task queue is helpful to make the > decision. > > Therefore I propose to expose it via JMX. The implementation could be > adding a simple method to org.apache.tomcat.util.net.AbstractEndpoint:
+1 Mark > public int getThreadPoolTaskQueueSize() { > if (executor!=null) { > if (executor instanceof ThreadPoolExecutor) { > return ((ThreadPoolExecutor)executor).getQueue().size(); > } else if (executor instanceof StandardThreadExecutor) { > return ((StandardThreadExecutor)executor).getQueueSize(); > } else { > return -1; > } > } else { > return -2; > } > } > > Another issue is that the default implementation of task queue is hard > coded to be infinite, I think it is better to make it configurable, > just like what StandardThreadExecutor does. But I think it worth > discussion in another thread. > > Comments welcome. > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org