Re: how to correct stop a thread and avoid leaks

2011-06-09 Thread Pid
On 07/06/2011 16:33, Bill Miller wrote: If you want to work with threads in tomcat you need to know about the Tomcat org.apache.catalina.LifecycleListener interface. Eh? Why would you need to put Tomcat specific dependencies in a spec compliant Servlet container? The above is simply not true.

Re: how to correct stop a thread and avoid leaks

2011-06-09 Thread Calum
On 9 June 2011 09:11, Pid p...@pidster.com wrote: Eh?  Why would you need to put Tomcat specific dependencies in a spec compliant Servlet container?  The above is simply not true. The OP use of a ServletContextListener is perfectly valid, (even if the rest of the code is a little odd). Is it

Re: how to correct stop a thread and avoid leaks

2011-06-09 Thread Pid
On 09/06/2011 18:44, Calum wrote: On 9 June 2011 09:11, Pid p...@pidster.com wrote: Eh? Why would you need to put Tomcat specific dependencies in a spec compliant Servlet container? The above is simply not true. The OP use of a ServletContextListener is perfectly valid, (even if the rest

RE: how to correct stop a thread and avoid leaks

2011-06-07 Thread Bill Miller
If you want to work with threads in tomcat you need to know about the Tomcat org.apache.catalina.LifecycleListener interface. If you implement the interface and register your class within server.xml your class will be notified of Tomcat life cycle events (Start, Stop, etc...). You can then do

Re: how to correct stop a thread and avoid leaks

2011-06-07 Thread alexis
yes, did that and it's working now. when contextDestroyed is called, i set the bool to false and force the loop out. What i was missing is loop is exited when if ((inputLine = in.readLine()) != null) this is completed, so, from Server class what i did is Listener.requestStop(); // this

how to correct stop a thread and avoid leaks

2011-06-06 Thread alexis
Hello, im running an app that has a class that implements ServletContextListener (Server class), on that class i create a thread of Listener (that implements Runnable) Listener starts a ServerSocket that listen on a port, and in a periodically manner, this app receives a string, parses the