• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please provide a sample code for this?
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic