JRJC timeout

Jaime Holland March 9, 2015

Hi,

I'm struggling to work out how to set relevant timeouts when using JRJC v2.0.0.  Can anybody help?

Any moderately long-running JQL produces a java.net.SocketTimeoutException exception.

I never had any issues when using version 1....

 

 

1 answer

0 votes
Guy Rouillier May 28, 2015
final JiraRestClientFactory jiraRestClientFactory = new AsynchronousJiraRestClientFactory();
    JiraRestClient jiraRestClient = null;
    try {
      final HttpClientOptions options = new HttpClientOptions();
      options.setConnectionTimeout(jiraConnectTimeout, TimeUnit.MILLISECONDS);
      options.setSocketTimeout(jiraSocketTimeout, TimeUnit.MILLISECONDS);
      options.setRequestPreparer(new Effect<Request>() {
        @Override
        public void apply(final Request request) {
          new BasicHttpAuthenticationHandler(jiraUsername, jiraPassword).configure(request);
        }
      });
      URI serverUri = new URI(jiraUri);
      final DefaultHttpClient defaultHttpClient = new DefaultHttpClient(new NoOpEventPublisher(),
          new RestClientApplicationProperties(serverUri), ThreadLocalContextManagers.noop(), options);
      jiraRestClient = jiraRestClientFactory.create(serverUri, defaultHttpClient);
    }
    catch (URISyntaxException e) {
      log.error("createJiraRestClient error creating client: " + e.getMessage(), e);
    }

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events