Liron Ar has uploaded a new change for review.

Change subject: core: add http connection timeouts
......................................................................

core: add http connection timeouts

This patch adds http connection timeout to the connections manager used
to initiate http connections - the connection timeout specifies a
timeout to be used until connection is established. 60 seconds seems
like a reasonable value to me.

Change-Id: I4e927ce28c8fdd9bcdcdb37e23b8d45c7515fd55
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/23527/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java
index 9332015..cffd88c 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/xmlrpc/XmlRpcUtils.java
@@ -16,6 +16,7 @@
 import org.apache.commons.httpclient.HttpMethodRetryHandler;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.httpclient.params.HttpClientParams;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
@@ -43,6 +44,8 @@
 
     private static final String HTTP = "http://";;
     private static final String HTTPS = "https://";;
+    private static final int SO_TIMEOUT = 60000;
+    private static final int CONN_TIMEOUT = 60000;
     private static Log log = LogFactory.getLog(XmlRpcUtils.class);
     static {
         if (Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)) {
@@ -139,6 +142,9 @@
     }
 
     private static HttpClient createHttpClient(int clientRetries) {
+        HttpConnectionManagerParams cmparams = new 
HttpConnectionManagerParams();
+        cmparams.setSoTimeout(SO_TIMEOUT);
+        cmparams.setConnectionTimeout(CONN_TIMEOUT);
         // Create the client:
         HttpClient client = new HttpClient(new 
MultiThreadedHttpConnectionManager());
 


-- 
To view, visit http://gerrit.ovirt.org/23527
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e927ce28c8fdd9bcdcdb37e23b8d45c7515fd55
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to