From d45341e45e44709193784623808d54a512025453 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 26 Aug 2014 08:11:29 +0000
Subject: [PATCH] Removed useless getChangeNumber() and setChangeNumber methods from *Operation interfaces. These methods are useless because setChangeNumber() is never set inside production code, so changeNumber is always equal to -1 for all the update operations. In addition it is very unlikely the ChangeNumberIndexer could have computed the changeNumber before a results are sent to a persistent search.
---
opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java | 53 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
index 4d9bc65..6f9eb8d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
@@ -149,13 +149,17 @@
}
if (shutdown)
+ {
return;
+ }
// Not suspended
doIt();
if (shutdown)
+ {
return;
+ }
suspendWriter();
}
@@ -178,12 +182,14 @@
}
finally
{
- if (session!=null)
+ if (session != null)
{
session.close();
}
if (replicationServerDomain != null)
+ {
replicationServerDomain.stopServer(handler, false);
+ }
}
}
@@ -195,24 +201,10 @@
*/
private void doIt() throws IOException, InterruptedException
{
- while (true)
+ while (!shutdown && !suspended)
{
- if (shutdown || suspended)
- {
- return;
- }
-
- ECLUpdateMsg update = null;
- try
- {
- update = handler.takeECLUpdate();
- }
- catch(DirectoryException de)
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, de);
- }
-
- if (update == null)
+ final ECLUpdateMsg updateMsg = takeECLUpdate(handler);
+ if (updateMsg == null)
{
if (session != null && handler.isInitPhaseDone())
{
@@ -232,14 +224,25 @@
}
else
{
- // Publish the update to the remote server using a protocol version it
- // supports
- publish(update);
- update = null;
+ // Publish the update to the remote server using a protocol version it supports
+ publish(updateMsg);
}
}
}
+ private ECLUpdateMsg takeECLUpdate(ECLServerHandler handler)
+ {
+ try
+ {
+ return handler.takeECLUpdate();
+ }
+ catch(DirectoryException de)
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, de);
+ return null;
+ }
+ }
+
/**
* Shutdown the writer.
*/
@@ -255,7 +258,9 @@
private void publish(ECLUpdateMsg msg) throws IOException
{
if (debugEnabled())
+ {
TRACER.debugInfo(getName() + " publishes msg=[" + msg + "]");
+ }
if (session != null)
{
@@ -265,8 +270,10 @@
{
try
{
+ // Using processAdd() because all ECLUpdateMsgs are adds to the external changelog
+ // (even though the underlying changes can be adds, deletes, modifies or modDNs)
Entry eclEntry = ECLSearchOperation.createEntryFromMsg(msg);
- mypsearch.processAdd(eclEntry, -1);
+ mypsearch.processAdd(eclEntry);
}
catch (Exception e)
{
--
Gitblit v1.10.0