On Tue, 7 Jul 2026 15:46:08 GMT, Daniel Fuchs <[email protected]> wrote:
> > I need to correct this misstatement I made earlier. > > CompletableFuture.cancel returns true even if the caller didn't win the > > cancelation race. So, Cancelable logic many run more than once. > > Yes - but this is OK. In fact it's probably better because now calling > cancel(true) after cancel(false) will allow to cancel/stop the background > tasks. Previously the first call to cancel(false) would have cancelled the > future without interrupting the background tasks, and the second call to > cancel(true) would have done nothing. So what you are proposing now looks > better. The added test to MinimalFutureTest verifies this behaviour. I agree that it's okay, but I didn't want to leave a false impression about the precise behavior. ------------- PR Comment: https://git.openjdk.org/jdk/pull/31758#issuecomment-4905676300
