From 0f96d54728f99cf2f995c912b62cf1d1ab2deec9 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 17 Oct 2013 09:49:29 +0000
Subject: [PATCH] ReplicationBroker.java: In toString(), improved the returned String. Changed rsServerId field from Integer to int.

---
 opends/src/server/org/opends/server/replication/service/ReplicationBroker.java |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
index e4bfe14..9b3dc97 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -99,7 +99,7 @@
   /** The group id of the RS we are connected to. */
   private byte rsGroupId = -1;
   /** The server id of the RS we are connected to. */
-  private Integer rsServerId = -1;
+  private int rsServerId = -1;
   /** The server URL of the RS we are connected to. */
   private String rsServerUrl;
   /** Our replication domain. */
@@ -114,7 +114,7 @@
    * as seen by the ReplicationServer the last time it was polled or the last
    * time it published monitoring information.
    */
-  private HashMap<Integer, ServerState> replicaStates =
+  private Map<Integer, ServerState> replicaStates =
     new HashMap<Integer, ServerState>();
   /**
    * The expected duration in milliseconds between heartbeats received
@@ -293,7 +293,7 @@
    * Gets the server id of the RS we are connected to.
    * @return The server id of the RS we are connected to
    */
-  public Integer getRsServerId()
+  public int getRsServerId()
   {
     return rsServerId;
   }
@@ -2388,11 +2388,13 @@
           MonitorMsg monitorMsg = (MonitorMsg) msg;
 
           // Extract and store replicas ServerStates
-          replicaStates = new HashMap<Integer, ServerState>();
+          final Map<Integer, ServerState> newReplicaStates =
+              new HashMap<Integer, ServerState>();
           for (int srvId : toIterable(monitorMsg.ldapIterator()))
           {
-            replicaStates.put(srvId, monitorMsg.getLDAPServerState(srvId));
+            newReplicaStates.put(srvId, monitorMsg.getLDAPServerState(srvId));
           }
+          replicaStates = newReplicaStates;
 
           // Notify the sender that the response was received.
           synchronized (monitorResponse)
@@ -3040,6 +3042,9 @@
   @Override
   public String toString()
   {
-    return getClass().getSimpleName() + " " + baseDN + " " + serverId;
+    return getClass().getSimpleName() + " \"" + baseDN + " " + serverId + "\","
+        + " groupId=" + groupId + ", genId=" + generationID
+        + ", bestRS(serverId=" + rsServerId + ", serverUrl=" + rsServerUrl
+        + ", groupId=" + rsGroupId + ")";
   }
 }

--
Gitblit v1.10.0