On Mon, 6 Jul 2026 17:28:38 GMT, Benjamin Peterson <[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.

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

PR Comment: https://git.openjdk.org/jdk/pull/31758#issuecomment-4905648723

Reply via email to