• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Tomcat doesn't sop all the deployed services when it is stopped

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have few web services deployed on tomcat and one of the service is configured as CRON job which runs periodically. Because of this non-deamon thread i suspect that the tomcat doesnt stop this service when tomcat itself has been stopped. How can I make sure that tomcat stops even the non deamon threads when I stop the server. Do we have any configurations that does this?
 
Saloon Keeper
Posts: 21598
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what sort of "cron" manager you're using, in part.

If you're running Quartz and you have a servlet that starts up Quartz, add a destroy() method override that shuts down Quartz.

Tomcat won't stop threads started by webapps, but it WILL hang waiting for the webapps to clean themselves up.
 
vinod meda
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please provide a sample code for this?
 
Tim Holloway
Saloon Keeper
Posts: 21598
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

vinod meda wrote:Can you please provide a sample code for this?



I think you need to do your own homework here. How you shut down the resource depends on how you set it up. All I can do is advise where to call it from. And, as I said, you call it from an override on the servlet destroy() method if a servlet set it up. If you used an an application startup context listener, you'd terminate in the corresponding shutdown listener.
 
vinod meda
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey. i am not sure which CRON manager we are using as I recently joined the proj. But, we are not using any servlet to start the job we use the jave Timet class to schedule the job.
 
Do Re Mi Fa So La Tiny Ad
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!