From 4bb3d3af3d032a98f2ca318c81be5c4f81034b8f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 11 Oct 2013 12:27:16 +0000
Subject: [PATCH] ReplicationBroker.java: In computeInitialServerStatus(), used early exits. In computeBestServerForWeight(), extracted methods computeBestServerWhenNotConnected() and computeBestServerWhenConnected(). Changed replicationServerUrls from Collection<String> to Set<String>. Removed useless field initialization to null. Renamed _publish() to publish() + reduced local variables scope. In receive(), renamed local variable replicationServerID to previousRsServerID and used this one more rather than the field. In changeConfig(), used Set.equals(). Changed getReplicationMonitor() to getReplicationMonitorInstanceName().
---
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java | 42 +++++++++++++++---------------------------
1 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index 38bd31d..5db7c3b 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -1478,7 +1478,7 @@
}
if (debugEnabled())
- TRACER.debugInfo("[IE] In " + getReplicationMonitorInstanceName()
+ TRACER.debugInfo("[IE] In " + broker.getReplicationMonitorInstanceName()
+ " export ends with " + " connected=" + broker.isConnected()
+ " exportRootException=" + exportRootException);
@@ -1585,11 +1585,6 @@
}
}
- private String getReplicationMonitorInstanceName()
- {
- return broker.getReplicationMonitor().getMonitorInstanceName();
- }
-
/**
* For all remote servers in the start list:
* - wait it has finished the import and present the expected generationID,
@@ -1835,7 +1830,8 @@
msg = broker.receive(false, false, true);
if (debugEnabled())
- TRACER.debugInfo("[IE] In " + getReplicationMonitorInstanceName()
+ TRACER.debugInfo("[IE] In "
+ + broker.getReplicationMonitorInstanceName()
+ ", receiveEntryBytes " + msg);
if (msg == null)
@@ -1888,7 +1884,7 @@
broker.publish(amsg, false);
if (debugEnabled())
TRACER.debugInfo("[IE] In "
- + getReplicationMonitorInstanceName()
+ + broker.getReplicationMonitorInstanceName()
+ ", publish InitializeRcvAckMsg" + amsg);
}
}
@@ -2072,13 +2068,12 @@
TRACER.debugInfo("[IE] Entering exportLDIFEntry pub entry="
+ Arrays.toString(lDIFEntry));
- // publish the message
boolean sent = broker.publish(entryMessage, false);
// process any publish error
- if (((!sent)||
- (broker.hasConnectionError()))||
- (broker.getNumLostConnections() != ieContext.initNumLostConnections))
+ if (!sent
+ || broker.hasConnectionError()
+ || broker.getNumLostConnections() != ieContext.initNumLostConnections)
{
// publish failed - store the error in the ieContext ...
DirectoryException de = new DirectoryException(ResultCode.OTHER,
@@ -2125,8 +2120,7 @@
* @throws DirectoryException If it was not possible to publish the
* Initialization message to the Topology.
*/
- public void initializeFromRemote(int source)
- throws DirectoryException
+ public void initializeFromRemote(int source) throws DirectoryException
{
initializeFromRemote(source, null);
}
@@ -2966,8 +2960,7 @@
* @throws ConfigException If the DirectoryServer configuration was
* incorrect.
*/
- public void startPublishService(
- Collection<String> replicationServers, int window,
+ public void startPublishService(Set<String> replicationServers, int window,
long heartbeatInterval, long changetimeHeartbeatInterval)
throws ConfigException
{
@@ -3078,18 +3071,15 @@
/**
* Change some ReplicationDomain parameters.
*
- * @param replicationServers The new list of Replication Servers that this
+ * @param replicationServers The new set of Replication Servers that this
* domain should now use.
* @param windowSize The window size that this domain should use.
* @param heartbeatInterval The heartbeatInterval that this domain should
* use.
* @param groupId The new group id to use
*/
- public void changeConfig(
- Collection<String> replicationServers,
- int windowSize,
- long heartbeatInterval,
- byte groupId)
+ public void changeConfig(Set<String> replicationServers, int windowSize,
+ long heartbeatInterval, byte groupId)
{
this.groupId = groupId;
@@ -3576,15 +3566,13 @@
Set<String> s2 = new HashSet<String>(s1);
s2.addAll(includeAttributesForDeletes);
- Set<String> s = eclIncludesByServer.get(serverId);
- if (!s1.equals(s))
+ if (!s1.equals(eclIncludesByServer.get(serverId)))
{
configurationChanged = true;
eclIncludesByServer.put(serverId, Collections.unmodifiableSet(s1));
}
- s = eclIncludesForDeletesByServer.get(serverId);
- if (!s2.equals(s))
+ if (!s2.equals(eclIncludesForDeletesByServer.get(serverId)))
{
configurationChanged = true;
eclIncludesForDeletesByServer.put(serverId,
@@ -3592,7 +3580,7 @@
}
// and rebuild the global list to be ready for usage
- s = new HashSet<String>();
+ Set<String> s = new HashSet<String>();
for (Set<String> attributes : eclIncludesByServer.values())
{
s.addAll(attributes);
--
Gitblit v1.10.0