[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Filotto updated HTTPCLIENT-2262:
----------------------------------------
    Description: 
I have a question regarding the expected behavior when setting a timeout to 0. 

In HttpClient, If I read for example [the Javadoc of the 
{{connectionRequestTimeout}}|https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java#L427],
 it tells me that a timeout of 0 is infinite.

In HttpCore, If I read [the Javadoc of 
{{Timeout#DISABLED}}|https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java#L58],
 it tells me that the timeout is simply disabled when set to 0 but what 
disabled means precisely?

If I keep digging in HttpCore, I see several classes like {{StrictConnPool}} 
that leverage {{Future}} and {{Lock}} for which a timeout set to 0, means that 
we expect an immediate result either with a success or a {{TimeoutException}}, 
so I assume that it is what we mean by "disabled timeout" but if so it would 
mean that it is in conflict with an infinite timeout as I personally don't 
expect to get a {{TimeoutException}} in case of an infinite timeout but maybe 
I'm wrong and it just needs to be clarified?



  was:
I have a question regarding the expected behavior when setting a timeout to 0. 

In HttpClient, If I read for example [the Javadoc of the 
{{connectionRequestTimeout}}|https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java#L427],
 it tells me that a timeout 0 is infinite.

In HttpCore, If I read [the Javadoc of 
{{Timeout#DISABLED}}|https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java#L58],
 it tells me that the timeout is simply disabled when set to 0 but what 
disabled means precisely?

If I keep digging in HttpCore, I see several classes like {{StrictConnPool}} 
that leverage {{Future}} and {{Lock}} for which a timeout set to 0, means that 
we expect an immediate result either with a success or a {{TimeoutException}}, 
so I assume that it is what we mean by "disabled timeout" but if so it would 
mean that it is in conflict with an infinite timeout as I personally don't 
expect to get a {{TimeoutException}} in case of an infinite timeout but maybe 
I'm wrong and it just needs to be clarified.

The timeouts defined in HttpClient seem to be provided as-is to the HttpCore 
components like in this example 
https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java#L99-L103




> Clarify infinite timeout vs disabled timeout
> --------------------------------------------
>
>                 Key: HTTPCLIENT-2262
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2262
>             Project: HttpComponents HttpClient
>          Issue Type: Task
>          Components: HttpClient (classic)
>    Affects Versions: 5.2.1
>            Reporter: Nicolas Filotto
>            Priority: Major
>
> I have a question regarding the expected behavior when setting a timeout to 
> 0. 
> In HttpClient, If I read for example [the Javadoc of the 
> {{connectionRequestTimeout}}|https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java#L427],
>  it tells me that a timeout of 0 is infinite.
> In HttpCore, If I read [the Javadoc of 
> {{Timeout#DISABLED}}|https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java#L58],
>  it tells me that the timeout is simply disabled when set to 0 but what 
> disabled means precisely?
> If I keep digging in HttpCore, I see several classes like {{StrictConnPool}} 
> that leverage {{Future}} and {{Lock}} for which a timeout set to 0, means 
> that we expect an immediate result either with a success or a 
> {{TimeoutException}}, so I assume that it is what we mean by "disabled 
> timeout" but if so it would mean that it is in conflict with an infinite 
> timeout as I personally don't expect to get a {{TimeoutException}} in case of 
> an infinite timeout but maybe I'm wrong and it just needs to be clarified?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to