I am executing a certain flow wherein I submit some task to Callable and store the output in Future<> future.
In some of the cases I am not calling future.get() to retrieve the value nor am I cancelling the task. Can this cause any issue?
I am executing a certain flow wherein I submit some task to
Callableand store the output inFuture<>future. In some of the cases I am not callingfuture.get()to retrieve the value nor am I cancelling the task. Can this cause any issue?
No it won't cause any issues. The future will be garbage collected as long as no one is holding a reference to it.
Obviously you could submit a Runnable instead of the Callable if you don't need the results from the call() method but it sounds to me like you want to programatically chose to just forget about the Callable which is fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With