diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-16 00:39:48 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-28 14:58:43 -0500 |
commit | 4549370d8e38d91ca2d89404c6f62f7e6358f328 (patch) | |
tree | 56071b2de47bfadd1451889ee87b64c8ea028fd7 /base/ca/src | |
parent | 358fdea85e8bcb482c40a9dc2c7fa72db03974cd (diff) | |
download | pki-4549370d8e38d91ca2d89404c6f62f7e6358f328.tar.gz pki-4549370d8e38d91ca2d89404c6f62f7e6358f328.tar.xz pki-4549370d8e38d91ca2d89404c6f62f7e6358f328.zip |
Fixed exceptions during shutdown.
The shutdown() methods in several classes have been fixed to allow
more graceful shutdown and clean restart. There are two types of
object attributes that need to be handled differently.
Attributes that are initialized by the constructor should not be
nulled during shutdown because they won't be reinitialized during
restart. If they require a cleanup (e.g. emptying collections,
closing LDAP connections) it's not necessary to check for null
before calling the cleanup method because they're never null.
For attributes that are initialized during init(), it may not be
necessary to do a cleanup or null the attribute since they might
still be used by other threads and they will be reinitialized
during restart so the old objects will be garbage collected. If
they do need a cleanup they should be checked for null because
they might still be null due to init() failure or initialization
conditionals.
If the attributes are initialized conditionally, the logic has been
modified to ensure the attributes are either initialized or set to
null.
Ticket #247
Diffstat (limited to 'base/ca/src')
-rw-r--r-- | base/ca/src/com/netscape/ca/CertificateAuthority.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/base/ca/src/com/netscape/ca/CertificateAuthority.java b/base/ca/src/com/netscape/ca/CertificateAuthority.java index f66192cf5..f8f3d7a9b 100644 --- a/base/ca/src/com/netscape/ca/CertificateAuthority.java +++ b/base/ca/src/com/netscape/ca/CertificateAuthority.java @@ -527,20 +527,19 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori CRLIssuingPoint point = (CRLIssuingPoint) enums.nextElement(); point.shutdown(); } + mCRLIssuePoints.clear(); if (mMasterCRLIssuePoint != null) { mMasterCRLIssuePoint.shutdown(); } - mSigningUnit = null; - mOCSPSigningUnit = null; - mCRLSigningUnit = null; if (mCertRepot != null) { mCertRepot.shutdown(); - mCertRepot = null; } - mCRLRepot = null; - mPublisherProcessor.shutdown(); + + if (mPublisherProcessor != null) { + mPublisherProcessor.shutdown(); + } } /** @@ -1695,12 +1694,12 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori } // a Master/full crl must exist. + CRLIssuingPoint masterCRLIssuePoint = null; while (issuePointIdEnum.hasMoreElements()) { String issuePointId = issuePointIdEnum.nextElement(); - CMS.debug( - "initializing crl issue point " + issuePointId); + CMS.debug("initializing crl issue point " + issuePointId); IConfigStore issuePointConfig = null; String issuePointClassName = null; Class<CRLIssuingPoint> issuePointClass = null; @@ -1713,9 +1712,11 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori issuePoint = issuePointClass.newInstance(); issuePoint.init(this, issuePointId, issuePointConfig); mCRLIssuePoints.put(issuePointId, issuePoint); - if (mMasterCRLIssuePoint == null && + + if (masterCRLIssuePoint == null && issuePointId.equals(PROP_MASTER_CRL)) - mMasterCRLIssuePoint = issuePoint; + masterCRLIssuePoint = issuePoint; + } catch (ClassNotFoundException e) { throw new ECAException( CMS.getUserMessage("CMS_CA_CRL_ISSUING_POINT_INIT_FAILED", @@ -1731,6 +1732,8 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori } } + mMasterCRLIssuePoint = masterCRLIssuePoint; + /* if (mMasterCRLIssuePoint == null) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CA_CA_NO_FULL_CRL", PROP_MASTER_CRL)); |