It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
Community showcase
Published in Halp

Halp - Conversational Ticketing Help Desk for internal requests

From the Halp Team Howdy!  👋   We’re Halp, a conversational ticketing help desk for all of your internal requests in Slack (and soon to be MS Teams!). We’re excited to be a par...

57 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you