From b6baf9b93cd501ac43200589d37feefd1e5291c2 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 04 Apr 2013 10:16:16 +0000
Subject: [PATCH] Another set of code cleanup, fixing typos.

---
 opends/src/server/org/opends/server/replication/server/DataServerHandler.java |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
index 9b41e5c..bb23940 100644
--- a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
@@ -23,7 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions copyright 2011-2012 ForgeRock AS
+ *      Portions copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.replication.server;
 
@@ -61,7 +61,7 @@
  */
 public class DataServerHandler extends ServerHandler
 {
-  // Temporay generationId received in handshake/phase1,
+  // Temporary generationId received in handshake/phase1,
   // and used after handshake/phase2
   long tmpGenerationId;
 
@@ -204,7 +204,7 @@
 
     if (newStatus == ServerStatus.INVALID_STATUS)
     {
-      Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId().toString(),
+      Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId(),
           Integer.toString(serverId), status.toString(), event.toString());
       logError(msg);
       return;
@@ -393,7 +393,7 @@
     ServerStatus newStatus = StatusMachine.computeNewStatus(status, event);
     if (newStatus == ServerStatus.INVALID_STATUS)
     {
-      Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId().toString(),
+      Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId(),
           Integer.toString(serverId), status.toString(), event.toString());
       logError(msg);
       return ServerStatus.INVALID_STATUS;
@@ -483,8 +483,21 @@
        * let the reader thread see the closure and cleanup any reference
        * to old connection. This must be done before taking the domain lock so
        * that the reader thread has a chance to stop the handler.
+       *
+       * TODO: This hack should be removed and disconnection/reconnection
+       * properly dealt with.
        */
-      replicationServerDomain.waitDisconnection(inServerStartMsg.getServerId());
+      if (replicationServerDomain.getConnectedDSs()
+          .containsKey(inServerStartMsg.getServerId()))
+      {
+        try {
+          Thread.sleep(100);
+        }
+        catch(Exception e){
+          abortStart(null);
+          return;
+        }
+      }
 
       // lock with no timeout
       lockDomain(false);
@@ -649,11 +662,10 @@
    */
   public DSInfo toDSInfo()
   {
-    DSInfo dsInfo = new DSInfo(serverId, replicationServerId, generationId,
+
+    return new DSInfo(serverId, replicationServerId, generationId,
       status, assuredFlag, assuredMode, safeDataLevel, groupId, refUrls,
       eclIncludes, eclIncludesForDeletes, protocolVersion);
-
-    return dsInfo;
   }
 
   /**

--
Gitblit v1.10.0