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 support in spring-aspects with AspectJ [SPR-7369] #12027

Closed
spring-projects-issues opened this issue Jul 14, 2010 · 12 comments
Closed

@Async support in spring-aspects with AspectJ [SPR-7369] #12027

spring-projects-issues opened this issue Jul 14, 2010 · 12 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 14, 2010

Keith Donald opened SPR-7369 and commented

I am using AspectJ for all aspects in my application, which right now includes ITDs and the @Transactional spring-aspect. I like the consistency in using AspectJ for AOP quite a bit, and would prefer to use it across the board rather than a hybrid approach. I now have a requirement to make a method @Async and noticed there doesn't appear to be an equivalent spring-aspect for this. It would be great to be able to make methods @Async with AspectJ in the same kind of way you can make methods @Transactional.

Perhaps Ramnivas could take a look at this?


Affects: 3.0.3

Issue Links:

Referenced from: commits 0098478, e1fb19f

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Ramnivas - care to comment?

@spring-projects-issues
Copy link
Collaborator Author

Ramnivas Laddad commented

I am on it (will take one of the aspects around the same idea from AspectJ in Action and make it Spring-quality).

@spring-projects-issues
Copy link
Collaborator Author

Keith Donald commented

Thanks Ramnivas! I'll use this feature as soon as you give me the word.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Guys, would you mind moving this to 3.1? Since this isn't entirely trivial, I'm not really keen on sneaking this into next week's 3.0.5...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Ramnivas, the 'next' branch is available and publishing 3.1 snapshots now. Keith, if you're OK upgrading your dependencies to this, then things would be seamless.

@spring-projects-issues
Copy link
Collaborator Author

Ramnivas Laddad commented

Yes, 3.1 makes more sense for this, since that will allows us making backward incompatible changes during milestones, if needed.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Rescheduled for 3.0.5 since we have an aspect in Roo which is known to work and hopefully easy enough to adapt for SFW.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Stefan Schmidt commented

On the Spring Roo side we have seen this problem when developing the Solr add-on as well. There are a number of (sometimes static) domain type methods offered (via ITDs) by this add-on which are better offered asynchronously. However, @Async was not picked up. As a workaround we are deploying a dedicated aspect:

@Configurable
public aspect SolrSearchAsyncTaskExecutor {

         @Autowired private ThreadPoolTaskExecutor taskExecutor;
          
         pointcut asyncMethods(): execution(void indexPets(..)) || execution(void indexPet(..)) || execution(void deleteIndex(..));

         void around(): asyncMethods() {
                 taskExecutor.execute(new Thread() {
                         public void run() {
                                 proceed();
                         }
                 });
         }
}

The pointcut could be adjusted to simply pick up methods which are annotated with @Async.

So from a Roo perspective it would be nice to avoid the deployment of such an aspect alltogether.

@spring-projects-issues
Copy link
Collaborator Author

Ramnivas Laddad commented

Support is now in 3.0.5.

Stefan, can you check this out and let me know if it meets Roo's needs.

I will port this over to 3.1 repository shortly.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Hi Ramnivas - great, I'll have a look at this as well ASAP. Stefan of course is the primary driving force behind 3.0.x inclusion here.

No need to port this over to 3.1 yet, actually: We'll do a general merge with recent 3.0.x changes once we're getting closer to 3.1 M1.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Stefan Schmidt commented

I have a test project ready to go against the latest SFW maven nightlies. However, those are not published yet because there was an unrelated build problem in Bamboo. So I am still waiting for something to test against ;).

@spring-projects-issues
Copy link
Collaborator Author

Stefan Schmidt commented

Ok, I was able to test this successfully after some additional feedback from Ramnivas. As soon as SFW 3.0.5 is released I will adjust the Roo Solr addon. Thanks for the quick turn around!

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant