Re: Killing threads in Application's onDestroy method
You should have a look at Terracotta Quartz, a very good scheduler. François Le 18 mai 2011 à 20:51, Henrique Boregio a écrit : > Hi, in my Wicket Application class, I create a couple of thread that > sleep most of the time..and come alive every one in a while to do some > maintenance tasks. > > I create them in the init() method of the Wicket Application...and > call kill() on them in the onDestroy() method. > > When I shutdown tomcat and restart it again (via the default .bat or > .sh), I can see from my log files that some threads from the previuos > deploy are still hanging around in memory. > > Am I doing something wrong? > > Many thanks. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Killing threads in Application's onDestroy method
W dniu 18.05.2011 21:16, Henrique Boregio pisze: My bad...that's actually what I am doing. I have a stop() method insite my threads that change a boolean value to false inside the while...instead of having while(tru) In this case, most probably your threads are running while your application is being closed. You can call Thread.join() or use CountDownLatch to wait for all the Threads to finish. Regards - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Killing threads in Application's onDestroy method
My bad...that's actually what I am doing. I have a stop() method insite my threads that change a boolean value to false inside the while...instead of having while(tru) On Wed, May 18, 2011 at 3:51 PM, Henrique Boregio wrote: > Hi, in my Wicket Application class, I create a couple of thread that > sleep most of the time..and come alive every one in a while to do some > maintenance tasks. > > I create them in the init() method of the Wicket Application...and > call kill() on them in the onDestroy() method. > > When I shutdown tomcat and restart it again (via the default .bat or > .sh), I can see from my log files that some threads from the previuos > deploy are still hanging around in memory. > > Am I doing something wrong? > > Many thanks. > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Killing threads in Application's onDestroy method
Don't kill your threads... You should code them the right way: public void run() { while(running) { // do stuff } } Instead of killing them, change the value of that boolean 'running' to false through any other method. Cheers, *Bruno Borges* www.brunoborges.com.br +55 21 76727099 On Wed, May 18, 2011 at 3:51 PM, Henrique Boregio wrote: > Hi, in my Wicket Application class, I create a couple of thread that > sleep most of the time..and come alive every one in a while to do some > maintenance tasks. > > I create them in the init() method of the Wicket Application...and > call kill() on them in the onDestroy() method. > > When I shutdown tomcat and restart it again (via the default .bat or > .sh), I can see from my log files that some threads from the previuos > deploy are still hanging around in memory. > > Am I doing something wrong? > > Many thanks. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Killing threads in Application's onDestroy method
Hi, in my Wicket Application class, I create a couple of thread that sleep most of the time..and come alive every one in a while to do some maintenance tasks. I create them in the init() method of the Wicket Application...and call kill() on them in the onDestroy() method. When I shutdown tomcat and restart it again (via the default .bat or .sh), I can see from my log files that some threads from the previuos deploy are still hanging around in memory. Am I doing something wrong? Many thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org