From c1d373b20260f0c225b1870e28e9af3b846805bc Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:35 +0000
Subject: [PATCH] TopologyCache.java: code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java |   44 +++++++-------------------------------------
 1 files changed, 7 insertions(+), 37 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
index 77f8f24..7ffe277 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package org.opends.admin.ads;
 
@@ -41,6 +41,7 @@
 import org.opends.admin.ads.util.PreferredConnection;
 import org.opends.admin.ads.util.ServerLoader;
 import org.opends.quicksetup.util.Utils;
+import org.opends.server.util.StaticUtils;
 
 import static com.forgerock.opendj.cli.Utils.*;
 
@@ -54,7 +55,6 @@
  */
 public class TopologyCache
 {
-
   private final ADSContext adsContext;
   private final ApplicationTrustManager trustManager;
   private final int timeout;
@@ -111,11 +111,9 @@
         threadSet.add(t);
       }
       joinThreadSet(threadSet);
-      /*
-       * Try to consolidate things (even if the data is not complete).
-       */
 
-      HashMap<LdapName, Set<SuffixDescriptor>> hmSuffixes = new HashMap<>();
+      // Try to consolidate things (even if the data is not complete)
+      Map<LdapName, Set<SuffixDescriptor>> hmSuffixes = new HashMap<>();
       for (ServerLoader loader : threadSet)
       {
         ServerDescriptor descriptor = loader.getServerDescriptor();
@@ -177,30 +175,7 @@
     }
   }
 
-  /**
-   * Returns the trust manager used by this class.
-   *
-   * @return the trust manager used by this class.
-   */
-  public ApplicationTrustManager getTrustManager()
-  {
-    return trustManager;
-  }
-
-  /**
-   * Returns the timeout to establish the connection in milliseconds.
-   *
-   * @return the timeout to establish the connection in milliseconds. Returns
-   * {@code 0} to express no timeout.
-   */
-  public int getConnectTimeout()
-  {
-    return timeout;
-  }
-
-  /**
-   * Reads the replication monitoring.
-   */
+  /** Reads the replication monitoring. */
   private void readReplicationMonitoring()
   {
     Set<ReplicaDescriptor> replicasToUpdate = getReplicasToUpdate();
@@ -415,9 +390,7 @@
         exceptions.add(e);
       }
     }
-    /*
-     * Check the exceptions and see if we throw them or not.
-     */
+    /* Check the exceptions and see if we throw them or not. */
     for (TopologyCacheException e : exceptions)
     {
       switch (e.getType())
@@ -532,10 +505,7 @@
               "Unexpected error closing enumeration on monitor entries" + t, t));
         }
       }
-      if (ctx != null)
-      {
-        ctx.close();
-      }
+      StaticUtils.close(ctx);
     }
   }
 

--
Gitblit v1.10.0