From c2e1e9fc0480a96bc816afea17866f0cd55e8ee5 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 15 Apr 2013 14:13:22 +0000
Subject: [PATCH] Spring cleanup in ECL. Fix typos, comments, warnings, I18N mess and overall tidy up the code. CR-1544.
---
opendj-sdk/opends/src/messages/messages/replication_de.properties | 2
opendj-sdk/opends/src/messages/messages/replication.properties | 3
opendj-sdk/opends/src/messages/messages/replication_es.properties | 2
opendj-sdk/opends/src/messages/messages/replication_fr.properties | 2
opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties | 2
opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java | 149 ++++++++++++++++++++++++++-----------------------
opendj-sdk/opends/src/messages/messages/replication_ja.properties | 2
7 files changed, 85 insertions(+), 77 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/replication.properties b/opendj-sdk/opends/src/messages/messages/replication.properties
index d403f20..0f6a92d 100644
--- a/opendj-sdk/opends/src/messages/messages/replication.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication.properties
@@ -385,7 +385,8 @@
attribute to DSEE NsUniqueID attribute. Value to be mapped: %s \
Error : %s
SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Full resync \
- required. Reason: The provided cookie contains unknown replicated domain %s
+ required. Reason: The provided cookie contains unknown replicated domain %s. \
+ Current starting cookie <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Full resync \
required. Reason: The provided cookie is older than the start of historical \
in the server for the replicated domain : %s
diff --git a/opendj-sdk/opends/src/messages/messages/replication_de.properties b/opendj-sdk/opends/src/messages/messages/replication_de.properties
index 9173d4c..722de97 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_de.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_de.properties
@@ -198,7 +198,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_VIRTUAL_ATTR_182=Fehler beim Laden eines virtuellen Attributs f\u00fcr externes \u00c4nderungsprotokoll: %s , Fehler: %s
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Fehler in %s beim Aktivieren des externen \u00c4nderungsprotokolls: %s
NOTICE_ERR_ENTRY_UID_DSEE_MAPPING_184=Fehler f\u00fcr Eintrag %s, wenn Eintrag UIDattribute zu Attribut DSEE NsUniqueID zugeordnung wird. Der zuzuordnende Wert: %s Fehler : %s
-SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Vollst\u00e4ndige Neusynchronisierung erforderlich. Ursache: Das angegebene Cookie enth\u00e4lt eine unbekannte replizierte Dom\u00e4ne %s
+SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Vollst\u00e4ndige Neusynchronisierung erforderlich. Ursache: Das angegebene Cookie enth\u00e4lt eine unbekannte replizierte Dom\u00e4ne %s. Aktuelle ab Cookie ist <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Vollst\u00e4ndige Neusynchronisierung erforderlich. Ursache: Das angegebene Cookie ist \u00e4lter als der Verlaufsstart im Server f\u00fcr die replizierte Dom\u00e4ne : %s
SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Ung\u00fcltige Syntax des angegebenen Cookies
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Dom\u00e4ne %s (Server-ID: %s) : Trennung vom Exporter-Server (Server-ID: %s ) w\u00e4hrend der Initialisierung
diff --git a/opendj-sdk/opends/src/messages/messages/replication_es.properties b/opendj-sdk/opends/src/messages/messages/replication_es.properties
index 0413646..95510c0 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_es.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_es.properties
@@ -198,7 +198,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_VIRTUAL_ATTR_182=Error al cargar un atributo virtual para el registro de cambios externo: Atributo: %s, Error: %s
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Error en %s al habilitar el registro de cambios externo: %s
NOTICE_ERR_ENTRY_UID_DSEE_MAPPING_184=Error de la entrada %s al asignar la entrada UIDattribute al atributo DSEE NsUniqueID Valor que debe asignarse: %s Error: %s
-SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Se requiere una resincronizaci\u00f3n completa. Raz\u00f3n: la cookie proporcionada contiene un dominio repetido desconocido %s
+SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Se requiere una resincronizaci\u00f3n completa. Raz\u00f3n: la cookie proporcionada contiene un dominio repetido desconocido %s. La cookie actual de partida es <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Se requiere una resincronizaci\u00f3n completa. Raz\u00f3n: la cookie proporcionada es anterior al inicio del hist\u00f3rico en el servidor para el dominio repetido: %s
SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=La sintaxis de la cookie proporcionada no es v\u00e1lida
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Dominio %s (Id. de servidor: %s) : se ha detectado la desconexi\u00f3n del servidor del exportador remoto (Id. de servidor: %s ) durante la inicializaci\u00f3n
diff --git a/opendj-sdk/opends/src/messages/messages/replication_fr.properties b/opendj-sdk/opends/src/messages/messages/replication_fr.properties
index 7e2f7df..0f460a3 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_fr.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_fr.properties
@@ -198,7 +198,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_VIRTUAL_ATTR_182=Erreur lors du chargement d'un attribut virtuel pour le journal des modifications externe\u00a0: attribut\u00a0: %s, erreur\u00a0: %s
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=Erreur de %s lors de l'activation du journal des modifications externe\u00a0: %s
NOTICE_ERR_ENTRY_UID_DSEE_MAPPING_184=Erreur de l'entr\u00e9e %s lors du mappage de l'entr\u00e9e UIDattribute sur l'attribut DSEE NsUniqueID. Valeur \u00e0 mapper\u00a0: %s - Erreur\u00a0: %s
-SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Resynchronisation compl\u00e8te requise. Raison\u00a0: le cookie fourni contient un domaine r\u00e9pliqu\u00e9 inconnu (%s)
+SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=Resynchronisation compl\u00e8te requise. Raison\u00a0: le cookie fourni contient un domaine r\u00e9pliqu\u00e9 inconnu (%s). Le cookie actuel de base est <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=Resynchronisation compl\u00e8te requise. Raison\u00a0: le cookie fourni est plus ancien que le d\u00e9but de l'historique sur le serveur pour le domaine r\u00e9pliqu\u00e9\u00a0: %s
SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=Syntaxe incorrecte pour le cookie fourni
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=Domaine %s (ID de serveur\u00a0: %s)\u00a0: d\u00e9connexion du serveur d'exportation distant (ID de serveur : %s) d\u00e9tect\u00e9e lors de l'initialisation
diff --git a/opendj-sdk/opends/src/messages/messages/replication_ja.properties b/opendj-sdk/opends/src/messages/messages/replication_ja.properties
index 4b89bb0..568ab0c 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_ja.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_ja.properties
@@ -198,7 +198,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_VIRTUAL_ATTR_182=\u5916\u90e8\u66f4\u65b0\u5c65\u6b74\u30ed\u30b0\u306e\u4eee\u60f3\u5c5e\u6027\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: \u5c5e\u6027: %s\u3001\u30a8\u30e9\u30fc: %s
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=\u5916\u90e8\u66f4\u65b0\u5c65\u6b74\u30ed\u30b0\u3092\u6709\u52b9\u306b\u3059\u308b\u3068\u304d\u306b\u3001%s \u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: %s
NOTICE_ERR_ENTRY_UID_DSEE_MAPPING_184=\u30a8\u30f3\u30c8\u30ea %s \u3067\u30a8\u30f3\u30c8\u30ea\u306e UIDattribute \u5c5e\u6027\u3092 DSEE NsUniqueID \u5c5e\u6027\u306b\u30de\u30c3\u30d7\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u30de\u30c3\u30d7\u5bfe\u8c61\u306e\u5024: %s\u3002\u30a8\u30e9\u30fc: %s
-SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u5b8c\u5168\u306a\u518d\u540c\u671f\u304c\u5fc5\u8981\u3067\u3059\u3002\u7406\u7531: \u63d0\u4f9b\u3055\u308c\u305f Cookie \u306b\u542b\u307e\u308c\u308b\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30c8\u3055\u308c\u305f\u30c9\u30e1\u30a4\u30f3 %s \u304c\u4e0d\u660e\u3067\u3059
+SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u5b8c\u5168\u306a\u518d\u540c\u671f\u304c\u5fc5\u8981\u3067\u3059\u3002\u7406\u7531: \u63d0\u4f9b\u3055\u308c\u305f Cookie \u306b\u542b\u307e\u308c\u308b\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30c8\u3055\u308c\u305f\u30c9\u30e1\u30a4\u30f3 %s \u304c\u4e0d\u660e\u3067\u3059\u3002Cookie <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=\u5b8c\u5168\u306a\u518d\u540c\u671f\u304c\u5fc5\u8981\u3067\u3059\u3002\u7406\u7531: \u63d0\u4f9b\u3055\u308c\u305f Cookie \u306f\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30c8\u3055\u308c\u305f\u30c9\u30e1\u30a4\u30f3\u306e\u30b5\u30fc\u30d0\u30fc\u3067\u306e\u5c65\u6b74\u958b\u59cb\u3088\u308a\u3082\u53e4\u3044\u3067\u3059: %s
SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=\u63d0\u4f9b\u3055\u308c\u305f Cookie \u306e\u7121\u52b9\u306a\u69cb\u6587
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=\u30c9\u30e1\u30a4\u30f3 %s (\u30b5\u30fc\u30d0\u30fc ID: %s): \u521d\u671f\u5316\u4e2d\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u5074\u306e\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u306e\u63a5\u7d9a\u89e3\u9664 (\u30b5\u30fc\u30d0\u30fc ID: %s) \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f
diff --git a/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties b/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
index 30acd95..28917a1 100644
--- a/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication_zh_CN.properties
@@ -198,7 +198,7 @@
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_VIRTUAL_ATTR_182=\u4e3a\u5916\u90e8\u66f4\u6539\u65e5\u5fd7\u52a0\u8f7d\u865a\u62df\u5c5e\u6027\u65f6\u51fa\u73b0\u9519\u8bef\uff1a\u5c5e\u6027: %s\uff0c\u9519\u8bef: %s
NOTICE_ERR_UNABLE_TO_ENABLE_ECL_183=\u542f\u7528\u5916\u90e8\u66f4\u6539\u65e5\u5fd7\u65f6\u5728 %s \u4e2d\u51fa\u73b0\u9519\u8bef: %s
NOTICE_ERR_ENTRY_UID_DSEE_MAPPING_184=\u5c06\u6761\u76ee UIDattribute \u6620\u5c04\u5230 DSEE NsUniqueID \u5c5e\u6027\u65f6\uff0c\u6761\u76ee %s \u51fa\u73b0\u9519\u8bef\u3002\u8981\u6620\u5c04\u7684\u503c: %s \u9519\u8bef: %s
-SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u8981\u6c42\u5b8c\u5168\u518d\u540c\u6b65\u3002\u539f\u56e0\uff1a\u63d0\u4f9b\u7684 cookie \u5305\u542b\u672a\u77e5\u7684\u590d\u5236\u57df %s
+SEVERE_ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE_185=\u8981\u6c42\u5b8c\u5168\u518d\u540c\u6b65\u3002\u539f\u56e0\uff1a\u63d0\u4f9b\u7684 cookie \u5305\u542b\u672a\u77e5\u7684\u590d\u5236\u57df %s\u3002Cookie <%s>
SEVERE_ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE_186=\u8981\u6c42\u5b8c\u5168\u518d\u540c\u6b65\u3002\u539f\u56e0\uff1a\u63d0\u4f9b\u7684 cookie \u65e9\u4e8e\u590d\u5236\u57df %s \u7684\u670d\u52a1\u5668\u4e2d\u7684\u5386\u53f2\u8d77\u70b9
SEVERE_ERR_INVALID_COOKIE_SYNTAX_187=\u63d0\u4f9b cookie \u7684\u8bed\u6cd5\u65e0\u6548
MILD_ERR_INIT_EXPORTER_DISCONNECTION_189=\u57df %s\uff08\u670d\u52a1\u5668 ID: %s\uff09\uff1a\u5728\u521d\u59cb\u5316\u671f\u95f4\u68c0\u6d4b\u5230\u8fdc\u7a0b\u5bfc\u51fa\u7a0b\u5e8f\u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5\uff08\u670d\u52a1\u5668 ID: %s\uff09
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index 0578313..69663a1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions Copyright 2010-2012 ForgeRock AS
+ * Portions Copyright 2010-2013 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -217,14 +217,11 @@
if (hasBecomeEligible)
{
- // it is now elligible
+ // it is now eligible
nextMsg = nextNonEligibleMsg;
nextNonEligibleMsg = null;
}
- else
- {
- // the oldest is still not elligible - let's wait next
- }
+ // else the oldest is still not eligible - let's wait next
}
else
{
@@ -279,6 +276,23 @@
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
}
+
+ /**
+ * Unregister the handler from the DomainContext ReplicationDomain.
+ * @return Whether the handler has been unregistered with success.
+ */
+ private boolean unRegisterHandler()
+ {
+ return rsd.unRegisterHandler(mh);
+ }
+
+ /**
+ * Stops the DomainContext handler.
+ */
+ private void stopServer()
+ {
+ rsd.stopServer(mh);
+ }
}
// The global list of contexts by domain for the search currently processed.
@@ -289,9 +303,8 @@
StringBuilder buffer = new StringBuilder();
buffer.append(msg);
buffer.append("\n");
- for (int i=0;i<domainCtxts.length;i++)
- {
- domainCtxts[i].toString(buffer);
+ for (DomainContext domainCtxt : domainCtxts) {
+ domainCtxt.toString(buffer);
buffer.append("\n");
}
return buffer.toString();
@@ -475,7 +488,7 @@
// log
logStartHandshakeRCVandSND(inECLStartMsg, outStartMsg);
- // until here session is encrypted then it depends on the negociation
+ // until here session is encrypted then it depends on the negotiation
// The session initiator decides whether to use SSL.
if (!sessionInitiatorSSLEncryption)
session.stopEncryption();
@@ -578,7 +591,7 @@
DraftCNDbHandler draftCNDb = replicationServer.getDraftCNDbHandler();
- // Any (optimizable) condition on draft CN in the request filter ?
+ // Any possible optimization on draft CN in the request filter ?
if (startDraftCN <= 1)
{
// Request filter DOES NOT contain any firstDraftCN
@@ -708,12 +721,14 @@
boolean allowUnknownDomains)
throws DirectoryException
{
- // This map is initialized from the providedCookie.
- // Below, it will be traversed and each domain configured with ECL will be
- // checked and removed from the map.
- // At the end, normally the map should be empty.
- // Depending on allowUnknownDomains provided flag, a non empty map will
- // be considered as an error when allowUnknownDomains is false.
+ /*
+ This map is initialized from the providedCookie.
+ Below, it will be traversed and each domain configured with ECL will be
+ checked and removed from the map.
+ At the end, normally the map should be empty.
+ Depending on allowUnknownDomains provided flag, a non empty map will
+ be considered as an error when allowUnknownDomains is false.
+ */
Map<String,ServerState> startStatesFromProvidedCookie =
new HashMap<String,ServerState>();
@@ -732,7 +747,6 @@
// and every domain.
HashSet<DomainContext> tmpSet = new HashSet<DomainContext>();
String missingDomains = "";
- int i =0;
if (rsdi != null)
{
while (rsdi.hasNext())
@@ -801,10 +815,12 @@
}
else if (!newDomainCtxt.startState.isEmpty())
{
- // when the provided startState is older than the replication
- // changelogdb start state, it means that the replication
- // changelog db has been trimed and the cookie is not valid
- // anymore.
+ /*
+ when the provided startState is older than the replication
+ changelogdb startState, it means that the replication
+ changelog db has been trimmed and the cookie is not valid
+ anymore.
+ */
boolean cookieTooOld = false;
for (int aServerId : rsd.getStartState())
{
@@ -850,7 +866,6 @@
// store the new context
tmpSet.add(newDomainCtxt);
- i++;
}
}
@@ -864,14 +879,16 @@
"<" + (providedCookie + missingDomains)+ ">"));
}
- domainCtxts = tmpSet.toArray(new DomainContext[0]);
+ domainCtxts = tmpSet.toArray(new DomainContext[tmpSet.size()]);
- // When it is valid to have the provided cookie containing unknown domains
- // (allowUnknownDomains is true), 2 cases must be considered :
- // - if the cookie contains a domain that is replicated but where
- // ECL is disabled, then this case is considered above
- // - if the cookie contains a domain that is even not replicated
- // then this case need to be considered here in another loop.
+ /*
+ When it is valid to have the provided cookie containing unknown domains
+ (allowUnknownDomains is true), 2 cases must be considered :
+ - if the cookie contains a domain that is replicated but where
+ ECL is disabled, then this case is considered above
+ - if the cookie contains a domain that is even not replicated
+ then this case need to be considered here in another loop.
+ */
if (!startStatesFromProvidedCookie.isEmpty())
{
if (allowUnknownDomains)
@@ -884,21 +901,20 @@
// Now do the final checking
if (!startStatesFromProvidedCookie.isEmpty())
{
- // After reading all the known domains from the provided cookie, there
- // is one (or several) domain that are not currently configured.
- // This domain has probably been removed or replication disabled on it.
- // The request is rejected and full resync is required.
- String unknownDomains = startStatesFromProvidedCookie.toString();
- String possibleCookie = "";
- for (int j=0; j<domainCtxts.length; j++)
- {
- possibleCookie += (domainCtxts[j].rsd.getBaseDn() + ":"
- + domainCtxts[j].startState + ";");
+ /*
+ After reading all the known domains from the provided cookie, there
+ is one (or several) domain that are not currently configured.
+ This domain has probably been removed or replication disabled on it.
+ The request is rejected and full resync is required.
+ */
+ StringBuilder sb = new StringBuilder();
+ for (DomainContext domainCtxt : domainCtxts) {
+ sb.append(domainCtxt.rsd.getBaseDn()).append(":")
+ .append(domainCtxt.startState).append(";");
}
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE.get(
- unknownDomains +
- ". Possible cookie: <" + possibleCookie+ ">"));
+ startStatesFromProvidedCookie.toString() ,sb.toString()));
}
// the next record from the DraftCNdb should be the one
@@ -906,12 +922,11 @@
// Initializes each and every domain with the next(first) eligible message
// from the domain.
- for (int j=0; j<domainCtxts.length; j++)
- {
- domainCtxts[j].getNextEligibleMessageForDomain(operationId);
+ for (DomainContext domainCtxt : domainCtxts) {
+ domainCtxt.getNextEligibleMessageForDomain(operationId);
- if (domainCtxts[j].nextMsg == null)
- domainCtxts[j].active = false;
+ if (domainCtxt.nextMsg == null)
+ domainCtxt.active = false;
}
}
catch(DirectoryException de)
@@ -955,15 +970,13 @@
draftCNDbIter.releaseCursor();
draftCNDbIter = null;
}
- for (int i=0;i<domainCtxts.length;i++)
- {
- if (!domainCtxts[i].rsd.unRegisterHandler(domainCtxts[i].mh))
- {
+ for (DomainContext domainCtxt : domainCtxts) {
+ if (!domainCtxt.unRegisterHandler()) {
logError(Message.raw(Category.SYNC, Severity.NOTICE,
- this +" shutdown() - error when unregistering handler "
- + domainCtxts[i].mh));
+ this + " shutdown() - error when unregistering handler "
+ + domainCtxt.mh));
}
- domainCtxts[i].rsd.stopServer(domainCtxts[i].mh);
+ domainCtxt.stopServer();
}
super.shutdown();
domainCtxts = null;
@@ -1102,7 +1115,7 @@
// Disable timeout for next communications
session.setSoTimeout(0);
}
- catch(Exception e) {}
+ catch(Exception e) { /* do nothing */ }
// sendWindow MUST be created before starting the writer
sendWindow = new Semaphore(sendWindowSize);
@@ -1147,7 +1160,7 @@
try
{
// to get the CL first and last
- // last rely on the crossDomainEligibleCN thhus must have been
+ // last rely on the crossDomainEligibleCN thus must have been
// computed before
int[] limits = computeCLLimits(crossDomainEligibleCN);
// Send the response
@@ -1291,7 +1304,7 @@
// Step 1 & 2
if (searchPhase == INIT_PHASE)
{
- // Normally we whould not loop .. except ...
+ // Default is not to loop, with one exception
continueLooping = false;
iDom = getOldestChangeFromDomainCtxts();
@@ -1376,7 +1389,7 @@
{
// the change from the DraftCNDb is older
// that means that the change has been purged from the
- // changelogDb (and DraftCNdb not yet been trimed)
+ // changelogDb (and DraftCNdb not yet been trimmed)
try
{
@@ -1387,7 +1400,7 @@
+ " will skip " + cnFromDraftCNDb
+ " and read next change from the DraftCNDb.");
- isEndOfDraftCNReached = (draftCNDbIter.next()==false);
+ isEndOfDraftCNReached = !draftCNDbIter.next();
if (debugEnabled())
TRACER.debugInfo("getNextECLUpdate generating draftCN "
@@ -1414,14 +1427,10 @@
break;
}
- else
- {
- // let's go to test this new change fro the DraftCNdb
- continue;
- }
}
catch(Exception e)
{
+ // TODO: At least log a warning
}
}
else
@@ -1476,7 +1485,7 @@
}
if (domainCtxts[iDom].active)
{
- // populates the table with the next eligible msg from idomain
+ // populates the table with the next eligible msg from iDom
// in non blocking mode, return null when no more eligible msg
domainCtxts[iDom].getNextEligibleMessageForDomain(operationId);
}
@@ -1489,10 +1498,9 @@
clDomCtxtsToString("In getNextECLUpdate (persistent): " +
"looking for the generalized oldest change");
- for (int ido=0; ido<domainCtxts.length; ido++)
- {
+ for (DomainContext domainCtxt : domainCtxts) {
// get next msg
- domainCtxts[ido].getNextEligibleMessageForDomain(operationId);
+ domainCtxt.getNextEligibleMessageForDomain(operationId);
}
// take the oldest one
@@ -1573,8 +1581,7 @@
+ dumpState());
// go to persistent phase if one
- for (int i=0; i<domainCtxts.length; i++)
- domainCtxts[i].active = true;
+ for (DomainContext domainCtxt : domainCtxts) domainCtxt.active = true;
if (this.isPersistent != StartECLSessionMsg.NON_PERSISTENT)
{
@@ -1590,7 +1597,7 @@
}
else
{
- // INIT_PHASE is done AND search is not persistent => reinit
+ // INIT_PHASE is done AND search is not persistent => re-init
searchPhase = UNDEFINED_PHASE;
}
--
Gitblit v1.10.0