On Fri, 17 Mar 2023 08:59:37 GMT, Viktor Klang <[email protected]> wrote:
>> Addresses the situation where exceptional completion of `orTimeout`:ed
>> CompletableFutures wouldn't cancel the timeout task which could lead to
>> memory leaks if done frequently enough with long enough timeout durations.
>>
>> Fix discussed with @DougLea
>
> Viktor Klang has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Adding a test for completeOnTimeout cancelling tasks when
> completeExceptionally
test/jdk/java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java
line 44:
> 42: void testOrTimeoutWithCompleteExceptionallyDoesNotLeak() {
> 43: var count = 0L;
> 44: while(count < 2_000_000) {
Nit
Suggestion:
while (count < 2_000_000) {
test/jdk/java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java
line 56:
> 54: void testCompleteOnTimeoutWithCompleteExceptionallyDoesNotLeak() {
> 55: var count = 0L;
> 56: while(count < 2_000_000) {
Nit
Suggestion:
while (count < 2_000_000) {
-------------
PR: https://git.openjdk.org/jdk/pull/13059