From a5f828cdb6549933c9f49783f99be1de1085a75e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 27 Aug 2013 09:57:22 +0000
Subject: [PATCH] Made code more encapsulated and more explicit. Removed parameters obscuring the code.
---
opends/src/server/org/opends/server/replication/server/MessageHandler.java | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/MessageHandler.java b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
index 5e049e3..9b34ed0 100644
--- a/opends/src/server/org/opends/server/replication/server/MessageHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -189,18 +189,19 @@
/**
* Returns the Replication Server Domain to which belongs this handler.
*
- * @param createIfNotExist Creates the domain if it does not exist.
* @param waitConnections Waits for the Connections with other RS to
* be established before returning.
* @return The replication server domain.
*/
- public ReplicationServerDomain getDomain(
- boolean createIfNotExist, boolean waitConnections)
+ public ReplicationServerDomain getDomain(boolean waitConnections)
{
- if (replicationServerDomain==null)
+ if (replicationServerDomain == null)
{
- replicationServerDomain = replicationServer.getReplicationServerDomain(
- baseDN, createIfNotExist, waitConnections);
+ replicationServerDomain =
+ replicationServer.getReplicationServerDomain(baseDN, true);
+ if (waitConnections) {
+ replicationServer.waitConnections();
+ }
}
return replicationServerDomain;
}
@@ -476,7 +477,7 @@
new TreeSet<ReplicationIterator>(new ReplicationIteratorComparator());
// Build a list of candidates iterator (i.e. db i.e. server)
- for (int serverId : replicationServerDomain.getServers())
+ for (int serverId : replicationServerDomain.getServerIds())
{
// get the last already sent CN from that server
ChangeNumber lastCsn = serverState.getChangeNumber(serverId);
@@ -525,20 +526,19 @@
* the number of updates to be sent is the size of the receive queue.
*/
if (following)
- return msgQueue.count();
- else
{
- /*
- * When the server is not able to follow, the msgQueue
- * may become too large and therefore won't contain all the
- * changes. Some changes may only be stored in the backing DB
- * of the servers.
- * The total size of the receive queue is calculated by doing
- * the sum of the number of missing changes for every dbHandler.
- */
- ServerState dbState = replicationServerDomain.getDbServerState();
- return ServerState.diffChanges(dbState, serverState);
+ return msgQueue.count();
}
+
+ /*
+ * When the server is not able to follow, the msgQueue may become too
+ * large and therefore won't contain all the changes. Some changes may
+ * only be stored in the backing DB of the servers.
+ * The total size of the receive queue is calculated by doing the sum of
+ * the number of missing changes for every dbHandler.
+ */
+ ServerState dbState = replicationServerDomain.getDbServerState();
+ return ServerState.diffChanges(dbState, serverState);
}
}
@@ -639,7 +639,7 @@
{
this.baseDN = baseDN;
if (!baseDN.equalsIgnoreCase("cn=changelog"))
- this.replicationServerDomain = getDomain(true, isDataServer);
+ this.replicationServerDomain = getDomain(isDataServer);
}
}
--
Gitblit v1.10.0