On 30/11/2015 15:51, jimi.hulleg...@svensktnaringsliv.se wrote:
> Hi,
> 
> When running code in a webapp, I know it is possible to detect an undeploy of 
> the webapp, or shutdown of Tomcat, using a ServletContextListener. But how 
> about code running outside the webapp?
> 
> The background for this is that we have written a plugin to a CMS, and this 
> plugin exists in the common/global classpath. The CMS calls the plugin on 
> certain occasions, triggered by some custom scheduling logic, and if we are 
> unlucky our plugin gets called during a shutdown of Tomcat giving us strange  
> errors that result in an unnecessary error report email being sent. So what I 
> would like to do is to add some check in our plugin, to avoid doing anything 
> if Tomcat is in the process of shutting down. But is this possible, without 
> some ugly hack?

Use a LifecycleListener that notifies your plug-in when Tomcat is
shutting down. See org.apache.catalina.startup.VersionLoggerListener for
an example.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to