From 9cdfa916fa7bdc0d4b56b8eddc5d623f5d4e2a95 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 26 Sep 2013 10:30:43 +0000
Subject: [PATCH] Code cleanup.
---
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 46 +++++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index f8d1c64..e4ab506 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -41,7 +41,7 @@
import org.opends.messages.MessageBuilder;
import org.opends.messages.Severity;
import org.opends.server.admin.server.ConfigurationChangeListener;
-import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.*;
+import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy;
import org.opends.server.admin.std.server.ExternalChangelogDomainCfg;
import org.opends.server.admin.std.server.ReplicationDomainCfg;
import org.opends.server.api.AlertGenerator;
@@ -62,7 +62,6 @@
import org.opends.server.protocols.ldap.LDAPModification;
import org.opends.server.replication.common.*;
import org.opends.server.replication.protocol.*;
-import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.replication.service.ReplicationDomain;
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
import org.opends.server.tasks.TaskUtils;
@@ -71,7 +70,7 @@
import org.opends.server.util.LDIFReader;
import org.opends.server.util.TimeThread;
import org.opends.server.workflowelement.externalchangelog.ECLWorkflowElement;
-import org.opends.server.workflowelement.localbackend.*;
+import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.messages.ToolMessages.*;
@@ -436,7 +435,7 @@
*/
try
{
- if (buildAndPublishMissingChanges(startCSN, broker))
+ if (buildAndPublishMissingChanges(startCSN))
{
message = DEBUG_CHANGES_SENT.get();
logError(message);
@@ -1262,8 +1261,8 @@
break;
}
}
- boolean attributeToBeFiltered = (fractionalExclusive && found)
- || (!fractionalExclusive && !found);
+ boolean attributeToBeFiltered = fractionalExclusive && found
+ || !fractionalExclusive && !found;
if (attributeToBeFiltered
&& !newRdn.hasAttributeType(attributeType)
&& !modifyDNOperation.deleteOldRDN())
@@ -1437,7 +1436,7 @@
private static boolean isFractionalProhibited(AttributeType attrType)
{
String attributeName = attrType.getPrimaryName();
- return (attributeName != null && isFractionalProhibitedAttr(attributeName))
+ return attributeName != null && isFractionalProhibitedAttr(attributeName)
|| isFractionalProhibitedAttr(attrType.getOID());
}
@@ -1453,8 +1452,8 @@
// Now remove the attribute or modification if:
// - exclusive mode and attribute is in configuration
// - inclusive mode and attribute is not in configuration
- return (foundAttribute && fractionalExclusive)
- || (!foundAttribute && !fractionalExclusive);
+ return foundAttribute && fractionalExclusive
+ || !foundAttribute && !fractionalExclusive;
}
private static boolean contains(Set<String> fractionalConcernedAttributes,
@@ -1857,16 +1856,8 @@
// this policy imply that we always accept updates.
return true;
}
- if (isolationPolicy.equals(IsolationPolicy.REJECT_ALL_UPDATES))
- {
- // this isolation policy specifies that the updates are denied
- // when the broker had problems during the connection phase
- // Updates are still accepted if the broker is currently connecting..
- return !hasConnectionError();
- }
- // we should never get there as the only possible policies are
- // ACCEPT_ALL_UPDATES and REJECT_ALL_UPDATES
- return true;
+ return !isolationPolicy.equals(IsolationPolicy.REJECT_ALL_UPDATES)
+ || !hasConnectionError();
}
@@ -2473,7 +2464,7 @@
op = msg.createOperation(conn);
dependency = remotePendingChanges.checkDependencies(op, msg);
- while (!dependency && !replayDone && (retryCount-- > 0))
+ while (!dependency && !replayDone && retryCount-- > 0)
{
if (shutdown.get())
{
@@ -2824,8 +2815,8 @@
for (Modification mod : mods)
{
AttributeType modAttrType = mod.getAttribute().getAttributeType();
- if ((mod.getModificationType() == ModificationType.DELETE
- || mod.getModificationType() == ModificationType.REPLACE)
+ if (mod.getModificationType() == ModificationType.DELETE
+ || mod.getModificationType() == ModificationType.REPLACE
&& currentRDN.hasAttributeType(modAttrType))
{
if (currentRDN.hasAttributeType(modAttrType))
@@ -4429,14 +4420,11 @@
*
* @param startCSN
* The CSN where we need to start the search
- * @param session
- * The session to use to publish the changes
* @return A boolean indicating he success of the operation.
* @throws Exception
* if an Exception happens during the search.
*/
- public boolean buildAndPublishMissingChanges(CSN startCSN,
- ReplicationBroker session) throws Exception
+ public boolean buildAndPublishMissingChanges(CSN startCSN) throws Exception
{
// Trim the changes in replayOperations that are older than the startCSN.
synchronized (replayOperations)
@@ -4494,7 +4482,7 @@
for (FakeOperation opToSend : opsToSend)
{
- session.publishRecovery(opToSend.generateMessage());
+ broker.publishRecovery(opToSend.generateMessage());
}
opsToSend.clear();
if (lastRetrievedChange != null)
@@ -5205,8 +5193,8 @@
return false;
// Compare modes
- if ((cfg1.isFractional() != cfg2.isFractional())
- || (cfg1.isFractionalExclusive() != cfg2.isFractionalExclusive()))
+ if (cfg1.isFractional() != cfg2.isFractional()
+ || cfg1.isFractionalExclusive() != cfg2.isFractionalExclusive())
return false;
// Compare all classes attributes
--
Gitblit v1.10.0