Liron Ar has uploaded a new change for review. Change subject: core: HttpConnManager - add explicit connection timeout ......................................................................
core: HttpConnManager - add explicit connection timeout 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. Currently we pass the timeout to the XmlRpcClientConfig only, therefore we can't count on it that when we'll use the HTTP connection outside of the XML-RPC transport layer timeout won't be encounterd. 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, 8 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/23729/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..747d48b 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; @@ -124,7 +125,7 @@ xmlRpcClient.setConfig(config); XmlRpcCommonsTransportFactory transportFactory = new CustomXmlRpcCommonsTransportFactory(xmlRpcClient); - HttpClient httpclient = createHttpClient(clientRetries); + HttpClient httpclient = createHttpClient(clientRetries, connectionTimeOut); transportFactory.setHttpClient(httpclient); xmlRpcClient.setTransportFactory(transportFactory); @@ -138,9 +139,13 @@ return returnValue; } - private static HttpClient createHttpClient(int clientRetries) { + private static HttpClient createHttpClient(int clientRetries, int connectionTimeout) { + HttpConnectionManagerParams params = new HttpConnectionManagerParams(); + params.setConnectionTimeout(connectionTimeout); + 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/23729 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
