diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2013-10-25 09:28:05 -0400 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2013-10-28 12:54:39 -0400 |
| commit | 3b2b7ea239fe85c0b90169402e0d1480122d20cc (patch) | |
| tree | 59cc6c92107c550a33599682bbcfedd2c033f824 /base/common/src/com | |
| parent | 6cadca3d05b25cb08da20882e891598a402c764f (diff) | |
Fixed errors during Tomcat shutdown.
Previously the CMS.shutdown() was called multiple times during Tomcat
shutdown, one by CMSStarServlet.destroy() and the other by the shutdown
hook, causing some errors. The shutdown hook should only be used in a
standalone application, so it has been moved into CMS.main().
Bugzilla #1018628
Diffstat (limited to 'base/common/src/com')
| -rw-r--r-- | base/common/src/com/netscape/certsrv/apps/CMS.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/apps/CMS.java b/base/common/src/com/netscape/certsrv/apps/CMS.java index 27cddadb8..fbcf65ac0 100644 --- a/base/common/src/com/netscape/certsrv/apps/CMS.java +++ b/base/common/src/com/netscape/certsrv/apps/CMS.java @@ -1661,5 +1661,22 @@ public final class CMS { start(path); } catch (EBaseException e) { } + + // Use shutdown hook in stand-alone application + // to catch SIGINT, SIGTERM, or SIGHUP. + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + /*LogDoc + * + * @phase watchdog check + */ + CMS.getLogger().log(ILogger.EV_SYSTEM, + ILogger.S_OTHER, + ILogger.LL_INFO, + "CMSEngine: Received shutdown signal"); + + CMS.shutdown(); + }; + }); } } |
