From 135b84019c85d6110c3fb97f4d6b2e8621c2daa4 Mon Sep 17 00:00:00 2001 From: Enrique Gonzalez Martinez Date: Fri, 19 Feb 2016 10:04:57 +0100 Subject: [PATCH] add support for concurrent use of the jira client --- src/main/java/net/rcarz/jiraclient/JiraClient.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/rcarz/jiraclient/JiraClient.java b/src/main/java/net/rcarz/jiraclient/JiraClient.java index 19ced48..18edb4f 100644 --- a/src/main/java/net/rcarz/jiraclient/JiraClient.java +++ b/src/main/java/net/rcarz/jiraclient/JiraClient.java @@ -27,12 +27,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.http.client.HttpClient; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.conn.PoolingClientConnectionManager; + import net.sf.json.JSON; import net.sf.json.JSONArray; import net.sf.json.JSONObject; -import org.apache.http.impl.client.DefaultHttpClient; - /** * A simple JIRA REST client. */ @@ -59,7 +61,10 @@ public class JiraClient { * @throws JiraException */ public JiraClient(String uri, ICredentials creds) throws JiraException { - DefaultHttpClient httpclient = new DefaultHttpClient(); + PoolingClientConnectionManager connManager = new PoolingClientConnectionManager(); + connManager.setDefaultMaxPerRoute(20); + connManager.setMaxTotal(40); + HttpClient httpclient = new DefaultHttpClient(connManager); restclient = new RestClient(httpclient, creds, URI.create(uri));