org.springframework.core.task.AsyncListenableTaskExecutor has submitListenable(Callable) method. This return ListenableFuture object after ListenableFutureTask.execute(ListenableFutureTask future). As Juergen Hoeller mentioned in the SPR-12358(https://jira.spring.io/i#browse/SPR-12358), if the async task has already been fully executed at the time of the addCallback call, Spring's ListenableFutureCallbackRegistry is executing the callback in the caller's thread since the async thread can't be used for it anymore. I think AsyncListenableTaskExecutor is needed to be improved in order to add callback before ListenableFutureTask.execute(ListenableFutureTask future) method is called.

ISSUE : SPR-12364

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

Comment From: pivotal-issuemaster

@MoonJongMin Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@MoonJongMin Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: snicoll

Thanks for the PR but we'd rather not add overloaded methods like this. JmsTemplate is usually used internally with a more defined API where such rich type is exposed at that level. The infrastructure is usually used internally in a higher-level API that can expose the rich type.