From eebef1864ed504063228cbbb16f41f3b0b7b3beb Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 06 Aug 2013 13:45:03 +0000
Subject: [PATCH] ECLServerHandler.java: In getNextECLUpdate(): - used local variables for the oldestChange to ease readability - removed if (searchPhase == INIT_PHASE) in the while loop - removed the suffix local variable in favour of reading on the ECLUpdateMsg object - extracted method assignDraftCN() Renamed storeNewChange() to assignNewDraftCNAndStore() and removed all parameters but the ECLUpdateMsg parameter.
---
opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java b/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
index 9efb33d..89548b3 100644
--- a/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
@@ -184,6 +184,13 @@
* {@link Database#count()} javadoc mentions: <blockquote>Note that this
* method does scan a significant portion of the database and should be
* considered a fairly expensive operation.</blockquote>
+ * <p>
+ * It could be faster to:
+ * <ul>
+ * <li>open a cursor, check if the next entry exits, then close the cursor
+ * </li>
+ * <li>call <code>db.readFirstDraftCN() != 0</code></li>
+ * </ul>
*
* @return <code>true</code> if this database is empty, <code>false</code>
* otherwise
@@ -347,12 +354,7 @@
public void clear(String baseDNToClear)
throws DatabaseException, Exception
{
- // FIXME according to JE javadoc, this is a "fairly expensive operation"
- // It could be faster to:
- // - open a cursor
- // - check if there is a next entry
- // - close the cursor (or reuse it down below)
- if (this.count() == 0)
+ if (isEmpty())
{
return;
}
--
Gitblit v1.10.0