From c0b8b47fd73ce55da9e76f2c901d204af40ad781 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 08 Aug 2016 08:05:17 +0000
Subject: [PATCH] ReplicationServerDomain.java: code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java |   78 +++++++--------------------------------
 1 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
index 2e14a40..645e403 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -174,8 +174,6 @@
    */
   private int assuredTimeoutTimerPurgeCounter;
 
-
-
   /**
    * Stores pending status messages such as DS change time heartbeats for future
    * forwarding to the rest of the topology. This class is required in order to
@@ -247,7 +245,6 @@
       pendingRSMonitorMsgs.put(rsServerId, msg);
     }
 
-    /** {@inheritDoc} */
     @Override
     public String toString()
     {
@@ -871,8 +868,7 @@
     }
 
     /**
-     * Run when the assured timeout for an assured update message we are waiting
-     * acks for occurs.
+     * Run when the assured timeout for an assured update message we are waiting acks for occurs.
      */
     @Override
     public void run()
@@ -923,12 +919,10 @@
           if (safeRead)
           {
             origServer.incrementAssuredSrReceivedUpdatesTimeout();
-          } else
+          }
+          else if (origServer.isDataServer())
           {
-            if (origServer.isDataServer())
-            {
-              origServer.incrementAssuredSdReceivedUpdatesTimeout();
-            }
+            origServer.incrementAssuredSdReceivedUpdatesTimeout();
           }
           //   retrieve expected servers in timeout to increment their counter
           List<Integer> serversInTimeout = expectedAcksInfo.getTimeoutServers();
@@ -963,7 +957,6 @@
     }
   }
 
-
   /**
    * Stop operations with a list of replication servers.
    *
@@ -1351,8 +1344,6 @@
     return servers;
   }
 
-
-
   /**
    * Processes a message coming from one server in the topology and potentially
    * forwards it to one or all other servers.
@@ -1553,8 +1544,6 @@
     return returnMsg;
   }
 
-
-
   /**
    * Creates a new monitor message including monitoring information for the
    * topology directly connected to this RS. This includes information for: -
@@ -1589,9 +1578,7 @@
     return monitorMsg;
   }
 
-  /**
-   * Shutdown this ReplicationServerDomain.
-   */
+  /** Shutdown this ReplicationServerDomain. */
   public void shutdown()
   {
     DirectoryServer.deregisterMonitorProvider(this);
@@ -1615,15 +1602,12 @@
     return domainDB.getDomainNewestCSNs(baseDN);
   }
 
-  /** {@inheritDoc} */
   @Override
   public String toString()
   {
-    return "ReplicationServerDomain " + baseDN;
+    return getClass().getSimpleName() + " " + baseDN;
   }
 
-
-
   /**
    * Creates a TopologyMsg filled with information to be sent to a remote RS.
    * We send remote RS the info of every DS that are directly connected to us
@@ -1968,9 +1952,7 @@
     return false;
   }
 
-  /**
-   * Update every peers (RS/DS) with topology changes.
-   */
+  /** Update every peers (RS/DS) with topology changes. */
   public void sendTopoInfoToAll()
   {
     enqueueTopoInfoToAllExcept(null);
@@ -1992,9 +1974,7 @@
     statusAnalyzer.notifyPendingStatusMessage();
   }
 
-  /**
-   * Clears the Db associated with that domain.
-   */
+  /** Clears the Db associated with that domain. */
   private void clearDbs()
   {
     try
@@ -2099,10 +2079,7 @@
         rsHandler.send(errorMsg);
       }
 
-      /*
-       * Sends the currently known topology information to every connected
-       * DS we have.
-       */
+      /* Sends the currently known topology information to every connected DS we have. */
       synchronized (pendingStatusMessagesLock)
       {
         pendingStatusMessages.enqueueTopoInfoToAllDSsExcept(null);
@@ -2157,7 +2134,6 @@
     return Collections.unmodifiableMap(connectedRSs);
   }
 
-
   /**
    * A synchronization mechanism is created to insure exclusive access to the
    * domain. The goal is to have a consistent view of the topology by locking
@@ -2183,9 +2159,7 @@
    */
   private final ReentrantLock lock = new ReentrantLock();
 
-  /**
-   * This lock is used to protect the generationId variable.
-   */
+  /** This lock is used to protect the generationId variable. */
   private final Object generationIDLock = new Object();
 
   /**
@@ -2207,9 +2181,7 @@
     lock.lockInterruptibly();
   }
 
-  /**
-   * Releases the lock on this domain.
-   */
+  /** Releases the lock on this domain. */
   public void release()
   {
     lock.unlock();
@@ -2226,9 +2198,7 @@
     return lock.tryLock(timeout, TimeUnit.MILLISECONDS);
   }
 
-  /**
-   * Starts the monitoring publisher for the domain if not already started.
-   */
+  /** Starts the monitoring publisher for the domain if not already started. */
   private void startMonitoringPublisher()
   {
     long period = localReplicationServer.getMonitoringPublisherPeriod();
@@ -2242,9 +2212,7 @@
     }
   }
 
-  /**
-   * Stops the monitoring publisher for the domain.
-   */
+  /** Stops the monitoring publisher for the domain. */
   private void stopMonitoringPublisher()
   {
     final MonitoringPublisher thread = monitoringPublisher.get();
@@ -2255,14 +2223,12 @@
     }
   }
 
-  /** {@inheritDoc} */
   @Override
   public void initializeMonitorProvider(MonitorProviderCfg configuraiton)
   {
     // Nothing to do for now
   }
 
-  /** {@inheritDoc} */
   @Override
   public String getMonitorInstanceName()
   {
@@ -2325,8 +2291,6 @@
     }
   }
 
-
-
   /**
    * Processes a ChangeTimeHeartbeatMsg received, by storing the CSN (timestamp)
    * value received, and forwarding the message to the other RSes.
@@ -2455,8 +2419,6 @@
         + ": " + message);
   }
 
-
-
   /**
    * Go through each connected DS, get the number of pending changes we have for
    * it and change status accordingly if threshold value is crossed/uncrossed.
@@ -2508,11 +2470,7 @@
     }
   }
 
-
-
-  /**
-   * Sends any enqueued status messages to the rest of the topology.
-   */
+  /** Sends any enqueued status messages to the rest of the topology. */
   void sendPendingStatusMessages()
   {
     /*
@@ -2531,8 +2489,6 @@
     sendPendingMonitorMsgs(savedState);
   }
 
-
-
   private void sendPendingMonitorMsgs(final PendingStatusMessages pendingMsgs)
   {
     for (Entry<Integer, MonitorMsg> msg : pendingMsgs.pendingDSMonitorMsgs
@@ -2574,8 +2530,6 @@
     }
   }
 
-
-
   private void sendPendingChangeTimeHeartbeatMsgs(PendingStatusMessages pendingMsgs)
   {
     for (ChangeTimeHeartbeatMsg pendingHeartbeat : pendingMsgs.pendingHeartbeats.values())
@@ -2601,8 +2555,6 @@
     }
   }
 
-
-
   private void sendPendingTopologyMsgs(PendingStatusMessages pendingMsgs)
   {
     if (pendingMsgs.sendDSTopologyMsg)
@@ -2628,8 +2580,6 @@
     }
   }
 
-
-
   private void enqueueMonitorMsg(MonitorRequestMsg msg, ServerHandler sender)
   {
     /*

--
Gitblit v1.10.0