We are facing issues with long running thread in tomcat . we are using Tomcat-7.0.47.Tomcat manager shows Current busy threads : 200, application gets stucked due to these long running threads. We implemented StuckThreadDetectionValve in server.xml( <Valve
className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />), but it could not help out. So we implemented custom StuckThreadDetectionValve by extending StuckThreadDetectionValve from catalina, it only goes to "constructor","initInternal",and in "invoke"(when action fires), it does not go to function "getStuckThreadNames()" even after threshold time.How to achieve the same.Is there any way to detect stucked thread and kill them? My custom Valve is like following : public class StuckThreadDetection extends StuckThreadDetectionValve { StuckThreadDetection stuckThreadDetection; public StuckThreadDetection() { System.out.println("in StuckThreadDetection constructor"); } public void invoke(Request request, Response response) throws IOException, ServletException { System.out.println("in invoke..."); getNext().invoke(request, response); } @Override protected void initInternal() throws LifecycleException { System.out.println("In initInternal"); super.initInternal(); } @Override public String[] getStuckThreadNames() { System.out.println("in getStuckThreadNames..."); String[] listStuckedThread = this.getStuckThreadNames(); for (String threadName : listStuckedThread) { System.out.println(threadName); } return listStuckedThread; } @Override public String getInfo() { System.out.println("In getInfo"); return super.getInfo(); } } -- *Thanks & Regards,* * Yogesh Patel*