I intended to use the Spring Framework's implementation of ListenableFuture since the code is going to be contained in a spring boot application. As noted in their doc, its inspired by guava com.google.common.util.concurrent.ListenableFuture
.
However unlike the guava ListenableFuture when looking at the documentation of the Spring implementation for addCallback completion callbacks/listeners, for both overloaded ones, there is no mention on which thread will execute the SuccessCallback
/FailureCallback
/ListenableFutureCallback
Does that mean they would default to being executed by the thread that completes the future?
Also on a side note, i am worried that without this contract being explicitly mentioned in the docs folks may be hesitant to use it. So is this being stated somewhere in the docs that i may have missed?
Thanks
For others who might have the same question i want to add the observed behavior (not officially documented AFAIK, if not folks can correct & point me to it).
The observed behavior as i suspected is that they are being executed by the thread that completes the future.
It would have been nice if the spring implementation had provided the same support as the guava one, but as it stands the above behavior is what we have. This is still better than the guava default of MoreExecutors.directExecutor()
where its done in the thread that invokes execute..
Thanks