zowe / zowe/zowe-client-java-sdk

Add Configurable HTTP Connection and Request Timeouts

Open
#629 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
55
Forks
32
Avg merge
1d 2m
Merged PRs (30d)
6

Description

Investigate and implement support for allowing consumers of the Zowe Client Java SDK to configure the HTTP connection and request timeouts used by the underlying Unirest 4.5.1 client.

Currently, the SDK uses an UnirestInstance for HTTP communication and relies on the default timeout configuration provided by Unirest.

Current Unirest Defaults

With Unirest Java 4.5.1, the default timeout configuration is:

Timeout:

Default - Connection timeout - 10 seconds (10,000 ms)

Request timeout - No timeout (infinite)

The connection timeout controls how long Unirest waits to establish a connection with the remote server.

The request timeout controls the overall amount of time allowed for a request to complete.

UnirestInstance Configuration:

The SDK's UnirestInstance can be configured directly through its Config object.

For example:

UnirestInstance unirest = Unirest.spawnInstance();

unirest.config()
.connectTimeout(10_000)
.requestTimeout(60_000);

This would configure: Connection timeout: 10 seconds AND Request timeout: 60 seconds

You could define new Zowe SDK system properties, then explicitly read them with System.getProperty() and apply them to the UnirestInstance.

For instance:

Define Zowe-specific system properties:

-Dzowe.client.connectTimeout=30000
-Dzowe.client.requestTimeout=120000

Then read them:

String connectTimeout = System.getProperty("zowe.client.connectTimeout");
String requestTimeout = System.getProperty("zowe.client.requestTimeout");

and applies them to the UnirestInstance:

if (connectTimeout != null) {
unirest.config().connectTimeout(Integer.parseInt(connectTimeout));
}

if (requestTimeout != null) {
unirest.config().requestTimeout(Integer.parseInt(requestTimeout));
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating where the SDK creates and configures its UnirestInstance, then review the Unirest 4.5.1 Config API for connectTimeout and requestTimeout. Check how Zowe-specific system properties should be read and validated. Done means consumers can configure both timeouts while existing defaults remain unchanged when no properties are supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.