Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java — Is it OK to discard Future return values?

If an async method returns a Future object, but we don't care whether the underlying operation succeeds or fails, are there any adverse effects from calling the method and not storing the returned Future?

Thanks in advance.

like image 508
Matthew H Avatar asked Sep 06 '25 03:09

Matthew H


1 Answers

If you also don't care whether the operation has been executed or cancelled, then yes, you can ignore the returned Future.

like image 99
JB Nizet Avatar answered Sep 07 '25 21:09

JB Nizet