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));
}
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));
}