2 years ago

#57817

test-img

samshers

For HttpClient (org.apache.http.client), what does "A negative value is interpreted as undefined (system default if applicable)" mean?

When I look at the source code of HttpClient which in turn uses org.apache.http.client.config.RequestConfig, I see below -

-taken from org.apache.http.client.config.RequestConfig.java

/**
     * Determines the timeout in milliseconds until a connection is established.
     * <p>
     * A timeout value of zero is interpreted as an infinite timeout.
     * A negative value is interpreted as undefined (system default if applicable).
     * </p>
     * <p>
     * Default: {@code -1}
     * </p>
     */
    public int getConnectTimeout() {
        return connectTimeout;
    }

I am not sure what System default here means. Does it mean that it will try to read System Properties and use that value. If this is the case then I will assume it will read connectTimeout system property and used the value of this property for this timeout config.

If I am wrong then kindly let me know what System default here means.

Edit - like @elliott-frisch pointed. Default means OS default. But now I am wondering where i can find these values for various Operating Systems. Like for Linux (Ubuntu/CentOS etc) and for Windows.

java

httpclient

resttemplate

connection-timeout

spring-resttemplate

0 Answers

Your Answer

Accepted video resources