Liron Ar has uploaded a new change for review. Change subject: core: HttpConnManager - add connection/sockets timeouts ......................................................................
core: HttpConnManager - add connection/sockets 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 and the socket timeout is the timeout for blocking socket operations - 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, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/23533/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..d076d25 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 CONN_TIMEOUT = 60000; + private static final int SOCK_TIMEOUT = 60000; private static Log log = LogFactory.getLog(XmlRpcUtils.class); static { if (Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)) { @@ -139,8 +142,13 @@ } private static HttpClient createHttpClient(int clientRetries) { + HttpConnectionManagerParams params = new HttpConnectionManagerParams(); + params.setConnectionTimeout(CONN_TIMEOUT); + params.setSoTimeout(SOCK_TIMEOUT); + MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager(); + httpConnectionManager.setParams(params); // Create the client: - HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager()); + HttpClient client = new HttpClient(httpConnectionManager); // Configure the HTTP client so it will retry the execution of // methods when there are IO errors: -- To view, visit http://gerrit.ovirt.org/23533 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
