From 5c3196a7dc35588f22aa086e4e5cf6a563ec0de0 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Wed, 08 Nov 2006 20:19:03 +0000
Subject: [PATCH] This fix removes the static nextId property as well as the getters and setters for it out of the EntryID class. The nextId property is now a non static property in the RootContainer class. Each RootContainer is responsible for keeping track of the next ID and assigning new entry IDs to all entries in its EntryContainers. 

---
 opends/src/server/org/opends/server/backends/jeb/BackendImpl.java |   43 ++++++++++++++++---------------------------
 1 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index aab7133..a1b3094 100644
--- a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -344,35 +344,23 @@
     // Preload the database cache.
     rootContainer.preload();
 
-    // Determine the next entry ID and the total number of entries.
-    EntryID highestID = null;
-    long entryCount = 0;
-    for (EntryContainer ec : rootContainer.getEntryContainers())
+    try
     {
-      try
-      {
-        EntryID id = ec.getHighestEntryID();
-        if (highestID == null || id.compareTo(highestID) > 0)
-        {
-          highestID = id;
-        }
-        entryCount += ec.getEntryCount();
-      }
-      catch (Exception e)
-      {
-        assert debugException(CLASS_NAME, "initializeBackend", e);
-        String message = getMessage(MSGID_JEB_HIGHEST_ID_FAIL);
-        throw new InitializationException(MSGID_JEB_HIGHEST_ID_FAIL,
-                                          message, e);
-      }
+      // Log an informational message about the number of entries.
+      int msgID = MSGID_JEB_BACKEND_STARTED;
+      String message = getMessage(msgID, rootContainer.getEntryCount());
+      logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, message,
+               msgID);
     }
-    EntryID.initialize(highestID);
-
-    // Log an informational message about the number of entries.
-    int msgID = MSGID_JEB_BACKEND_STARTED;
-    String message = getMessage(msgID, entryCount);
-    logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, message,
-             msgID);
+    catch(DatabaseException databaseException)
+    {
+      assert debugException(CLASS_NAME, "initializeBackend",
+                            databaseException);
+      String message = getMessage(MSGID_JEB_GET_ENTRY_COUNT_FAILED,
+                                  databaseException.getMessage());
+      throw new InitializationException(MSGID_JEB_GET_ENTRY_COUNT_FAILED,
+                                        message, databaseException);
+    }
 
     // Register this backend as a configurable component.
     DirectoryServer.registerConfigurableComponent(this);
@@ -400,6 +388,7 @@
     assert debugEnter(CLASS_NAME, "finalizeBackend");
 
     // Deregister our configurable components.
+    // TODO: configurableEnv is always null and will not be deregistered.
     if (configurableEnv != null)
     {
       DirectoryServer.deregisterConfigurableComponent(configurableEnv);

--
Gitblit v1.10.0