From 692dd815da23d7fce14dff285f8ade9df6214a2a Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 04 Dec 2014 20:09:15 +0000
Subject: [PATCH] OPENDJ-1602 (CR-5566) New pluggable storage based backend
---
opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistitSuffixContainer.java | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistitSuffixContainer.java b/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistitSuffixContainer.java
index 31dd3d7..b49b4f2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistitSuffixContainer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistitSuffixContainer.java
@@ -40,6 +40,7 @@
import com.sleepycat.je.DatabaseException;
import static org.opends.messages.JebMessages.*;
+import static org.opends.server.core.DirectoryServer.*;
/**
* Persistit implementation of a {@link SuffixContainer}.
@@ -209,6 +210,29 @@
}
}
+ /** {@inheritDoc} */
+ @Override
+ public Entry getEntry(EntryID entryID) throws DirectoryException
+ {
+ // Try the entry cache first.
+ final EntryCache entryCache = getEntryCache();
+ final PersistitBackend backend = rootContainer.getBackend();
+ final Entry cacheEntry = entryCache.getEntry(backend, entryID.longValue());
+ if (cacheEntry != null)
+ {
+ return cacheEntry;
+ }
+
+ final Entry entry = id2entry.get(null, entryID, null);
+ if (entry != null)
+ {
+ // Put the entry in the cache making sure not to overwrite a newer copy
+ // that may have been inserted since the time we read the cache.
+ entryCache.putEntryIfAbsent(entry, backend, entryID.longValue());
+ }
+ return entry;
+ }
+
/**
* Indicates whether an entry with the specified DN exists.
*
--
Gitblit v1.10.0