diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-06-16 14:12:54 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-06-18 20:04:31 -0400 |
commit | b9f51eb366c98647544d1d090cb9dbd0d29c6e09 (patch) | |
tree | ad4bd3d43dd87e7f24200859199e90ce13f5d3f1 /base/server/cms/src/com/netscape/cms/logging/LogFile.java | |
parent | 311650625be0c8e5f42c71c7d5020e5a11ecf034 (diff) | |
download | pki-b9f51eb366c98647544d1d090cb9dbd0d29c6e09.tar.gz pki-b9f51eb366c98647544d1d090cb9dbd0d29c6e09.tar.xz pki-b9f51eb366c98647544d1d090cb9dbd0d29c6e09.zip |
Fixed thread leaks during shutdown.
Various codes have been modified to properly stop threads during
shutdown. A new ID attribute has been added to the LDAP connection
factory classes to help identify leaking threads.
https://fedorahosted.org/pki/ticket/1327
Diffstat (limited to 'base/server/cms/src/com/netscape/cms/logging/LogFile.java')
-rw-r--r-- | base/server/cms/src/com/netscape/cms/logging/LogFile.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/base/server/cms/src/com/netscape/cms/logging/LogFile.java b/base/server/cms/src/com/netscape/cms/logging/LogFile.java index c465a4e53..9d19eddc6 100644 --- a/base/server/cms/src/com/netscape/cms/logging/LogFile.java +++ b/base/server/cms/src/com/netscape/cms/logging/LogFile.java @@ -519,6 +519,8 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { if (fileName == null) throw new ELogException(CMS.getUserMessage("CMS_LOG_INVALID_FILE_NAME", "null")); + CMS.debug("Creating " + getClass().getSimpleName() + "(" + fileName + ")"); + //If we want to reuse the old log files //mFileName = fileName + "." + mLogFileDateFormat.format(mDate); mFileName = fileName; @@ -863,9 +865,10 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { * </ul> */ public synchronized void shutdown() { - String auditMessage = null; - CMS.debug("LogFile:In log shutdown"); + CMS.debug("Destroying LogFile(" + mFileName + ")"); + + String auditMessage = null; setFlushInterval(0); @@ -891,10 +894,13 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { public synchronized void setFlushInterval(int flushInterval) { mFlushInterval = flushInterval * 1000; - if ((mFlushThread == null) && (mFlushInterval > 0)) { + if (mFlushThread == null && mFlushInterval > 0) { mFlushThread = new FlushThread(); mFlushThread.setDaemon(true); mFlushThread.start(); + + } else if (mFlushThread != null && mFlushInterval == 0) { + mFlushThread.interrupt(); } this.notify(); @@ -921,9 +927,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { try { LogFile.this.wait(mFlushInterval); } catch (InterruptedException e) { - // This shouldn't happen very often - ConsoleError.send(new - SystemEvent(CMS.getUserMessage("CMS_LOG_THREAD_INTERRUPT", "flush"))); + // shutdown } } |