From 29d39ea8a732927a33298672dda475035d33e811 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Wed, 19 Oct 2011 11:34:28 +0000
Subject: [PATCH] LMS-2580 Timeout set to 5 minutes.

SVN: 23343
---
 .../authentication/crowd/CrowdAuthenticationService.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/authentication/source/java/ch/systemsx/cisd/authentication/crowd/CrowdAuthenticationService.java b/authentication/source/java/ch/systemsx/cisd/authentication/crowd/CrowdAuthenticationService.java
index 7e71f37e0c6..df13fae8d27 100644
--- a/authentication/source/java/ch/systemsx/cisd/authentication/crowd/CrowdAuthenticationService.java
+++ b/authentication/source/java/ch/systemsx/cisd/authentication/crowd/CrowdAuthenticationService.java
@@ -26,10 +26,12 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.apache.log4j.Logger;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -58,6 +60,8 @@ import ch.systemsx.cisd.common.logging.LogFactory;
  */
 public class CrowdAuthenticationService implements IAuthenticationService
 {
+    private static final int CONNECTION_TIMEOUT = (int) (5 * DateUtils.MILLIS_PER_MINUTE);
+
     private static final String DUMMY_TOKEN_STR = "DUMMY-TOKEN";
 
     private static final String EMAIL_PROPERTY_KEY = "mail";
@@ -144,6 +148,8 @@ public class CrowdAuthenticationService implements IAuthenticationService
                     try
                     {
                         final HttpClient client = new HttpClient();
+                        HttpConnectionManager connectionManager = client.getHttpConnectionManager();
+                        connectionManager.getParams().setConnectionTimeout(CONNECTION_TIMEOUT);
                         final PostMethod post = new PostMethod(serviceUrl);
                         final StringRequestEntity entity =
                                 new StringRequestEntity(message, "application/soap+xml", "utf-8");
-- 
GitLab