From 17bff7f202a911ac8f0f73c047c86e1a5d662ec9 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 12 Apr 2007 22:16:10 +0000
Subject: [PATCH] Update the DirectoryServer class so that it resets the JDK logger whenever the server shuts down.  This is necessary to prevent an exception when performing an in-core restart (as described in issue #1289) or potentially other cases in which the server may need to be started multiple times in the same JVM (e.g., as in issue #1495).

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

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 07ec1bb..f017b69 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -7893,6 +7893,19 @@
     }
 
 
+    // The JDK logger doesn't allow you to deregister things, so we have to
+    // reset it.  This is necessary to avoid exceptions if you perform an
+    // in-core restart or stop the server and start a new instance in the same
+    // JVM (which currently isn't possible through any means other than an
+    // in-core restart but might be exposed at some point).
+    //
+    // FIXME -- This could cause problems with an application that's embedding
+    //          OpenDS and also using the JDK logger.  The solution for this
+    //          will come once we have rewritten the loggers so that we no
+    //          longer use the JDK logging framework.
+    java.util.logging.LogManager.getLogManager().reset();
+
+
     // Just in case there's something that isn't shut down properly, wait for
     // the monitor to give the OK to stop.
     shutdownMonitor.waitForMonitor();

--
Gitblit v1.10.0