From ac27a41b85595ecd2444a64d822ab37aa8722fed Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Thu, 21 May 2015 09:34:32 +0000
Subject: [PATCH] Use backendID for entry cache rather than backend instance. RootContainer is now directly constructed with the Storage rather than getting it from the Backend.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java
index c0ba4bb..9e00d76 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java
@@ -70,10 +70,10 @@
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** The tree storage. */
- private Storage storage;
+ private final Storage storage;
- /** The backend to which this entry root container belongs. */
- private final BackendImpl<?> backend;
+ /** The ID of the backend to which this entry root container belongs. */
+ private final String backendId;
/** The backend configuration. */
private final PluggableBackendCfg config;
/** The monitor for this backend. */
@@ -93,13 +93,14 @@
*
* @param config
* The configuration of the backend.
- * @param backend
+ * @param backendID
* A reference to the backend that is creating this root
* container.
*/
- RootContainer(BackendImpl<?> backend, PluggableBackendCfg config)
+ RootContainer(String backendID, Storage storage, PluggableBackendCfg config)
{
- this.backend = backend;
+ this.backendId = backendID;
+ this.storage = storage;
this.config = config;
getMonitorProvider().enableFilterUseStats(config.isIndexFilterAnalyzerEnabled());
@@ -130,7 +131,6 @@
{
try
{
- storage = backend.getStorage();
storage.open();
storage.write(new WriteOperation()
{
@@ -169,7 +169,7 @@
EntryContainer openEntryContainer(DN baseDN, WriteableTransaction txn)
throws StorageRuntimeException, ConfigException
{
- EntryContainer ec = new EntryContainer(baseDN, backend, config, storage, this);
+ EntryContainer ec = new EntryContainer(baseDN, backendId, config, storage, this);
ec.open(txn);
return ec;
}
@@ -258,8 +258,7 @@
{
if (monitor == null)
{
- String monitorName = backend.getBackendID() + " Storage";
- monitor = new BackendMonitor(monitorName, this);
+ monitor = new BackendMonitor(backendId + " Storage", this);
}
return monitor;
}
@@ -300,9 +299,7 @@
}
catch (StorageRuntimeException e)
{
- logger.traceException(e);
-
- logger.error(ERR_CACHE_PRELOAD, backend.getBackendID(),
+ logger.error(ERR_CACHE_PRELOAD, backendId,
stackTraceToSingleLineString(e.getCause() != null ? e.getCause() : e));
}
}
@@ -333,7 +330,6 @@
if (storage != null)
{
storage.close();
- storage = null;
}
}
--
Gitblit v1.10.0