tomcat6 - Stop Apache Tomcat when web application stops -


scenario:

apache tomcat 6.0 started service on windows server 2008 r2 using wrapper (org.tanukisoftware.wrapper.wrapperstartstop) uses org.apache.catalina.startup.bootstrap. in course of tomcat startup 1 web application started. web application needs connect remote database , check connection. retries connect couple of times if database not available , shutsdown after x tries.

problem:

i need stop apache tomcat after webapp exits when database connection not available.

possible solutions:

  • stop apache tomcat within web application (already tried shutdown port did not work because connection refused - standalone java application worked)
  • call external java application within web application
  • configure apache tomcat shutdown if web application shuts down - not find way that

any ideas? maybe different approach?

regards

alexander

system.exit(0) within webapp shut down tomcat instance if there no security manager configured.

works standalone server, not sure whether works when running windows service.

edit: though might want read this: calling system.exit() in servlet's destroy() method


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -