It would be nice if the number of stuck threads reported by StuckThreadDetectionValve was available through jmx (e.g. stuckThreadCount). The number of stuck threads is stored in the stuckCount variable. However there is no jmx attribute for it, there is only getter for stuckThreadIds which is long[]. I usually use tool like jmxtrans to get the value and plot a graph with graphite.
Created attachment 32045 [details] Patch for getting stuckThreadCount through jmx This would be nice to have in tomcat7 too.
Fixed in trunk in r1626991. Will be in Tomcat 8.0.13 and later. Fixed in Tomcat 7. Will be in Tomcat 7.0.56 and later.