From 90da5492eb74a2661a5624cbfad6a4bc9f85a99c Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 29 Mar 2007 00:35:01 +0000
Subject: [PATCH] Update the Directory Server shutdown process to account for the possibility that some components may not have been created yet if the shutdown is due to a failure that occurred on startup.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index f6ec02f..43fb847 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -7524,7 +7524,10 @@
 
 
     // Stop the work queue.
-    directoryServer.workQueue.finalizeWorkQueue(reason);
+    if (directoryServer.workQueue != null)
+    {
+      directoryServer.workQueue.finalizeWorkQueue(reason);
+    }
 
 
     // Notify all the shutdown listeners.
@@ -7553,21 +7556,24 @@
 
 
     // Deregister all of the JMX MBeans.
-    Set mBeanSet = directoryServer.mBeanServer.queryMBeans(null, null);
-    for (Object o : mBeanSet)
+    if (directoryServer.mBeanServer != null)
     {
-      if (o instanceof DirectoryServerMBean)
+      Set mBeanSet = directoryServer.mBeanServer.queryMBeans(null, null);
+      for (Object o : mBeanSet)
       {
-        try
+        if (o instanceof DirectoryServerMBean)
         {
-          DirectoryServerMBean mBean = (DirectoryServerMBean) o;
-          directoryServer.mBeanServer.unregisterMBean(mBean.getObjectName());
-        }
-        catch (Exception e)
-        {
-          if (debugEnabled())
+          try
           {
-            debugCaught(DebugLogLevel.ERROR, e);
+            DirectoryServerMBean mBean = (DirectoryServerMBean) o;
+            directoryServer.mBeanServer.unregisterMBean(mBean.getObjectName());
+          }
+          catch (Exception e)
+          {
+            if (debugEnabled())
+            {
+              debugCaught(DebugLogLevel.ERROR, e);
+            }
           }
         }
       }
@@ -7618,7 +7624,10 @@
 
 
     // Perform any necessary cleanup work for the group manager.
-    directoryServer.groupManager.finalizeGroupManager();
+    if (directoryServer.groupManager != null)
+    {
+      directoryServer.groupManager.finalizeGroupManager();
+    }
 
 
     // Shut down all the other components that may need special handling.

--
Gitblit v1.10.0