Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Async Supporting ListenableFuture [SPR-11909] #16528

Closed
spring-issuemaster opened this issue Jun 24, 2014 · 3 comments
Closed

@Async Supporting ListenableFuture [SPR-11909] #16528

spring-issuemaster opened this issue Jun 24, 2014 · 3 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jun 24, 2014

Ronald R. DiFrango opened SPR-11909 and commented

It would be nice if via the @Async/@EnableAsync annotations or via start-up configuration that instead of AsyncExecutionInterceptor calling executor.submit(), it would executor.submitListenable() provided the TaskExecutor supports it.


Affects: 4.0.5

Issue Links:

  • #16708 @Async Supporting ListenableFuture not applied with AspectJ

Referenced from: commits 46dc07a

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jun 26, 2014

Juergen Hoeller commented

AsyncExecutionInterceptor automatically uses submitListenable if an @Async method signature indicates ListenableFuture now. The determineAsyncExecutor method wraps the target Executor in a TaskExecutorAdapter anyway, so it uses an AsyncListenableTaskExecutor check now and wraps if the target executor doesn't implement it already. Furthermore, AsyncResult implements ListenableFuture now, for convenient use within such ListenableFuture-declaring @Async methods.

Juergen

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jun 26, 2014

Ronald R. DiFrango commented

Just curious, how does a method signature on an @Async method indicate that it supports ListenableFuture? Also, will this apply if the @Async is at the class level?

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jun 26, 2014

Juergen Hoeller commented

It's a return type check: If a method declares a return type of ListenableFuture now, submitListenable will be used to fulfil that requirement. It doesn't matter whether @Async is being declared at the method or type level there. This is why AsyncResult has to implement ListenableFuture as well: Formally, that's what your method has to wrap its result value in then.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.