From c5ab3254dc665b820ca65ea919c5c2f5f5e0d110 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 12 Nov 2013 13:52:24 +0000
Subject: [PATCH] CR-2563 JEChangelogDB removing a synchronized block in a heavily hit path

---
 opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java b/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java
index 032dcad..67d2404 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java
@@ -133,33 +133,34 @@
   /**
    * Creates a new ReplicaDB associated to a given LDAP server.
    *
-   * @param id Identifier of the DB.
+   * @param serverId The serverId for which changes will be stored in the DB.
    * @param baseDN the baseDN for which this DB was created.
    * @param replicationServer The ReplicationServer that creates this ReplicaDB.
    * @param dbenv the Database Env to use to create the ReplicationServer DB.
    * server for this domain.
-   * @param queueSize The queueSize to use when creating the ReplicaDB.
    * @throws ChangelogException If a database problem happened
    */
-  public JEReplicaDB(int id, DN baseDN, ReplicationServer replicationServer,
-      ReplicationDbEnv dbenv, int queueSize) throws ChangelogException
+  public JEReplicaDB(int serverId, DN baseDN,
+      ReplicationServer replicationServer, ReplicationDbEnv dbenv)
+      throws ChangelogException
   {
     this.replicationServer = replicationServer;
-    serverId = id;
+    this.serverId = serverId;
     this.baseDN = baseDN;
     trimAge = replicationServer.getTrimAge();
+    final int queueSize = replicationServer.getQueueSize();
     queueMaxSize = queueSize;
     queueLowmark = queueSize / 5;
     queueHimark = queueSize * 4 / 5;
     queueMaxBytes = 200 * queueMaxSize;
     queueLowmarkBytes = 200 * queueLowmark;
     queueHimarkBytes = 200 * queueLowmark;
-    db = new ReplicationDB(id, baseDN, replicationServer, dbenv);
+    db = new ReplicationDB(serverId, baseDN, replicationServer, dbenv);
     oldestCSN = db.readOldestCSN();
     newestCSN = db.readNewestCSN();
     thread = new DirectoryThread(this, "Replication server RS("
         + replicationServer.getServerId()
-        + ") changelog checkpointer for Replica DS(" + id
+        + ") changelog checkpointer for Replica DS(" + serverId
         + ") for domain \"" + baseDN + "\"");
     thread.start();
 

--
Gitblit v1.10.0