RFR: 8267140: Support closing the HttpClient by making it auto-closable [v4]

Jaikiran Pai jpai at openjdk.org
Mon Mar 20 13:00:42 UTC 2023


On Mon, 20 Mar 2023 12:50:48 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
>> 
>>  - Merge branch 'master' into HttpClient-close-8267140
>>  - Update test/jdk/java/net/httpclient/HttpClientShutdown.java
>>    
>>    Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>>  - Update test/jdk/java/net/httpclient/ShutdownNow.java
>>    
>>    Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>>  - Update test/jdk/java/net/httpclient/HttpClientShutdown.java
>>    
>>    Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>>  - Update test/jdk/java/net/httpclient/AsyncShutdownNow.java
>>    
>>    Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>>  - Review feedback
>>  - typo
>>  - Merge branch 'master' into HttpClient-close-8267140
>>  - Throw NPE if duration is null
>>  - 8267140
>
> src/java.net.http/share/classes/java/net/http/HttpClient.java line 769:
> 
>> 767:     /**
>> 768:      * Blocks until all operations have completed execution after a shutdown
>> 769:      * request, or the timeout occurs, or the current thread is
> 
> If I understand this correctly, this method is expected to be called after `shutdown()` or `shutdownNow()` has been called. If so, then should this method throw an `IllegalStateException` if it gets called before any of those shutdown methods are called?

Do you think we could reword this sentence to, to have necessary pointers to `duration` and thread interruption:

> Blocks until all operations have completed execution after a shutdown request, or the {@code duration} passes, or the current thread is {@linkplain Thread#interrupt() interrupted}, whichever happens first.

-------------

PR: https://git.openjdk.org/jdk/pull/13019


More information about the net-dev mailing list