From 03fe0954e42abf00746b8efa4c79ee74cf514427 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 15:10:50 +0000
Subject: [PATCH] Fix an issue with connection timeouts in CLI. The timeout is now configurable on CLI with the --connectTimeout option (expressed in milliseconds), the default is 30 000 milliseconds. This solves Issue 4196.

---
 opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index b9c5ef6..17f049e 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -1593,7 +1593,7 @@
     if (loginDialog == null)
     {
       loginDialog = new LoginDialog(qs.getDialog().getFrame(),
-          getTrustManager());
+          getTrustManager(), getConnectTimeout());
       loginDialog.pack();
     }
     Utilities.centerOnComponent(loginDialog, qs.getDialog().getFrame());
@@ -1626,7 +1626,7 @@
           LOG.log(Level.INFO, "Loading Topology Cache in askForAuthentication");
           ADSContext adsContext = new ADSContext(ctx);
           TopologyCache cache = new TopologyCache(adsContext,
-              getTrustManager());
+              getTrustManager(), getConnectTimeout());
           cache.getFilter().setSearchMonitoringInformation(false);
           cache.reloadTopology();
           return cache;
@@ -2011,6 +2011,7 @@
             getUninstallUserData().getAdminUID());
         String pwd = getUninstallUserData().getAdminPwd();
         ctx = getRemoteConnection(server, dn, pwd, getTrustManager(),
+            getConnectTimeout(),
             new LinkedHashSet<PreferredConnection>());
 
         // Update replication servers and domains.  If the domain
@@ -2305,5 +2306,15 @@
     }
     return isServerToUninstall;
   }
+
+  /**
+   * Returns the timeout to be used to connect in milliseconds.
+   * @return the timeout to be used to connect in milliseconds.  Returns
+   * {@code 0} if there is no timeout.
+   */
+  private int getConnectTimeout()
+  {
+    return getUserData().getConnectTimeout();
+  }
 }
 

--
Gitblit v1.10.0