Link to home
Start Free TrialLog in
Avatar of Amit
AmitFlag for United States of America

asked on

How to close Java Threads in servlets

Hi,

I am getting this warning in an java servlet application which is deployed on tomcat. I am creating threads to do scheduled task execution. But I am not destroying/stopping the threads in any part of the code as I don't know what't the best way to handle it in servlets without crashing the whole application or tomcat.

Please help how to prevent memory leaks so that I can run the app forever without being forced to restart the app all the time

thanks
-anshu



Nov 16, 2015 4:52:20 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/abcd1234] has started
Nov 16, 2015 4:52:20 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [/abcd1234] appears to have started a thread named [pool-1-thread-1] but has failed to stop it. This is very likely to create a memory leak.
Nov 16, 2015 4:52:22 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Nov 16, 2015 4:52:22 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/abcd1234] is completed
Avatar of Amit
Amit
Flag of United States of America image

ASKER

ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is in reference to the following question

https://www.experts-exchange.com/questions/28808959/How-to-create-java-threads-with-multiple-start-and-run-signatures.html
Are you sure it's not more apt to quote THIS one?
Avatar of Amit

ASKER

thank you experts
You're welcome!