Open Alan-Chen-au opened 9 years ago
more information shown below :
net.rcarz.jiraclient.JiraException: Failed to retrieve issue PROVSERV-14990
at net.rcarz.jiraclient.Issue.realGet(Issue.java:1001)
at net.rcarz.jiraclient.Issue.get(Issue.java:1024)
at net.rcarz.jiraclient.JiraClient.getIssue(JiraClient.java:99)
at net.onthenet.jirarest.javaclient.OTNIssue.
solved and updated JiraClient.java
... ... import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; ... ...
public class JiraClient {
private RestClient restclient = null;
private String username = null;
// Added by Alan Chen for Multi-thread problem
// Date : 2015/11/09
private static CloseableHttpClient httpClient = null;
private static PoolingHttpClientConnectionManager connManager = null;
/**
* Creates a JIRA client.
*
* @param uri Base URI of the JIRA server
* @throws JiraException
*/
public JiraClient(String uri) throws JiraException {
this(uri, null);
}
/**
* Creates an authenticated JIRA client.
*
* @param uri Base URI of the JIRA server
* @param creds Credentials to authenticate with
* @throws JiraException
*/
public JiraClient(String uri, ICredentials creds) throws JiraException {
// Modified by Alan Chen for Muti-thread problem
// Date : 2015/11/09
// DefaultHttpClient httpclient = new DefaultHttpClient();
if (null == httpClient) {
connManager = new PoolingHttpClientConnectionManager();
connManager.setDefaultMaxPerRoute(20);
connManager.setMaxTotal(40);
httpClient = HttpClients.custom().setConnectionManager(connManager).build();
}
restclient = new RestClient(httpClient, creds, URI.create(uri));
if (creds != null) {
username = creds.getLogonName();
//intialize connection if required
creds.initialize(restclient);
}
}
I still get this error, happens when multiple requests are made simultaneously
send me your sample code and let me have a look !
On Wed, Jan 6, 2016 at 6:28 AM, jefdcruz notifications@github.com wrote:
I still get this error, happens when multiple requests are made simultaneously
— Reply to this email directly or view it on GitHub https://github.com/rcarz/jira-client/issues/110#issuecomment-169122534.
What do you think about having a constructor that allows passing in the HttpClient
?
I'm also getting this issue. I use this library in a Spring boot application. I have a Service (scope = prototype) where the jira API is used. I'm getting the exception only when multiple requests are made simultaneously.
Update:
I see your fix on GitHub, however, I don't see it in net.rcarz:jira-client:0.5
I use the following dependency in Gradle:
// https://mvnrepository.com/artifact/net.rcarz/jira-client
compile group: 'net.rcarz', name: 'jira-client', version: '0.5'
Thank you.
@tess1o net.rcarz:jira-client:0.5 ---> this was previous release; which cannot support this feature. Just clone the current one which should be fine.
@btiernay It is another option. I believe it is a good way in some scenarios.
@rcarz may give us more comments I believe.
I checked this version two months ago. I use jira-client in Multi-thread env.
any suggestion? Thanks Alan