Re: Cleaning up threads on GWT application shutdown

2010-06-17 Thread jjd
Jason and jhulford,

Thanks for your advice.  I checked into ServletContextListener and it
looks like it should work fine.  I'm about to give it a try.

Thanks.

--Jim--

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Cleaning up threads on GWT application shutdown

2010-06-10 Thread Jason Morris
Hi Jim,

Generally I would register a ServletContextListener with the
application-server (in your case Tomcat) to start and stop background
services. You would register it in your web.xml file:

listener
listener-classcom.company.webapp.MyContextListener/listener-class
/listener

Hope this is what you're looking for.
//Jason

On Wed, Jun 9, 2010 at 12:02 AM, jjd jjdemp...@gmail.com wrote:
 I have a GWT application that starts an independent thread and leaves
 it running for use by multiple GWT sessions.

 It appears that under Tomcat, when I Stop of Undeploy the application,
 this thread keeps running.  I can't figure out the right way to manage
 shutting down the thread when the application is stopped (but tomcat
 keeps running).

 I tried adding a ShutdownHook using
 Runtime.getRuntime().addShutdownHook(), but that doesn't get called
 until Tomcat itself is shutdown.

 What is the proper way to manage threads at application shutdown time?

 Thanks,

 --Jim--

 --
 You received this message because you are subscribed to the Google Groups 
 Google Web Toolkit group.
 To post to this group, send email to google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to 
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Cleaning up threads on GWT application shutdown

2010-06-10 Thread jhulford
Technically, the proper way according to the specs is to not utilize
background threads.  Of course, since nobody actually obeys that
proclamation, use a ServletContextListener to start your Thread when
the servlet context is started and stop the thread when the context is
being destroyed.  In general, that's the proper way to do any init /
teardown work in a web application.

On Jun 8, 6:02 pm, jjd jjdemp...@gmail.com wrote:
 I have a GWT application that starts an independent thread and leaves
 it running for use by multiple GWT sessions.

 It appears that under Tomcat, when I Stop of Undeploy the application,
 this thread keeps running.  I can't figure out the right way to manage
 shutting down the thread when the application is stopped (but tomcat
 keeps running).

 I tried adding a ShutdownHook using
 Runtime.getRuntime().addShutdownHook(), but that doesn't get called
 until Tomcat itself is shutdown.

 What is the proper way to manage threads at application shutdown time?

 Thanks,

 --Jim--

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.