From b7dde5b118fe17e86a65bb53c35322d2ba64aa55 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 05 Aug 2013 15:03:12 +0000
Subject: [PATCH] Code cleanup.

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/MessageHandler.java |   46 ++++++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/MessageHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/MessageHandler.java
index 1d34a19..833f3c9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/MessageHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -31,6 +31,7 @@
 import static org.opends.server.loggers.debug.DebugLogger.*;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -78,14 +79,6 @@
    */
   protected ReplicationServer replicationServer = null;
   /**
-   * The URL of the hosting replication server.
-   */
-  protected String replicationServerURL = null;
-  /**
-   * The serverID of the hosting replication server.
-   */
-  protected int replicationServerId;
-  /**
    * Specifies the related replication server domain based on baseDn.
    */
   protected ReplicationServerDomain replicationServerDomain = null;
@@ -108,7 +101,7 @@
   /**
    * Specifies whether the consumer is following the producer (is not late).
    */
-  protected boolean following = false;
+  private boolean following = false;
   /**
    * Specifies the current serverState of this handler.
    */
@@ -132,20 +125,12 @@
    * Creates a new server handler instance with the provided socket.
    * @param queueSize The maximum number of update that will be kept
    *                  in memory by this ServerHandler.
-   * @param replicationServerURL The URL of the hosting replication server.
-   * @param replicationServerId The ID of the hosting replication server.
    * @param replicationServer The hosting replication server.
    */
-  public MessageHandler(
-      int queueSize,
-      String replicationServerURL,
-      int replicationServerId,
-      ReplicationServer replicationServer)
+  public MessageHandler(int queueSize, ReplicationServer replicationServer)
   {
     this.maxQueueSize = queueSize;
     this.maxQueueBytesSize = queueSize * 100;
-    this.replicationServerURL = replicationServerURL;
-    this.replicationServerId = replicationServerId;
     this.replicationServer = replicationServer;
   }
 
@@ -228,18 +213,16 @@
    *          requested.
    */
   @Override
-  public ArrayList<Attribute> getMonitorData()
+  public List<Attribute> getMonitorData()
   {
-    ArrayList<Attribute> attributes = new ArrayList<Attribute>();
+    List<Attribute> attributes = new ArrayList<Attribute>();
     attributes.add(Attributes.create("handler", getMonitorInstanceName()));
     attributes.add(
         Attributes.create("queue-size", String.valueOf(msgQueue.count())));
     attributes.add(
         Attributes.create(
             "queue-size-bytes", String.valueOf(msgQueue.bytesCount())));
-    attributes.add(
-        Attributes.create(
-            "following", String.valueOf(following)));
+    attributes.add(Attributes.create("following", String.valueOf(following)));
     return attributes;
   }
 
@@ -560,7 +543,7 @@
         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
@@ -680,9 +663,6 @@
    */
   public void shutdown()
   {
-    /*
-     * Shutdown ServerWriter
-     */
     synchronized (msgQueue)
     {
       msgQueue.clear();
@@ -719,6 +699,16 @@
    */
   public int getReplicationServerId()
   {
-    return this.replicationServerId;
+    return this.replicationServer.getServerId();
+  }
+
+  /**
+   * Get the server URL of the hosting replication server.
+   *
+   * @return the replication server URL.
+   */
+  public String getReplicationServerURL()
+  {
+    return this.replicationServer.getServerURL();
   }
 }

--
Gitblit v1.10.0