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

Invocation of @Async service fails [SPR-10636] #15264

Closed
spring-issuemaster opened this issue Jun 7, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jun 7, 2013

Dimitar Makariev opened SPR-10636 and commented

The described feature works on 3.2.1.RELEASE, fails on 3.2.2.RELEASE and 3.2.3.RELEASE.

Trying to change object instance passed to service defined as @Async :

@Service
public class PopulateService {

    private final List<Person> persons;
    private final AsyncService asyncService;

    @Autowired
    public PopulateService(AsyncService asyncService) {
        persons = new ArrayList<Person>();
        this.asyncService = asyncService;
    }

    public void populatePersons(int numberOfPersons) {
        asyncService.populatePersons(persons, numberOfPersons);
    }

    public List<Person> getPersons() {
        return persons;
    }
}

@Service
public class AsyncService {

    @Async
    public void populatePersons(List<Person> persons, int numberOfPersons) {
        for (int i = 0; i < numberOfPersons; i++) {
            persons.add(new Person("first " + i, "last " + i));
        }
    }
} 

Affects: 3.2.2, 3.2.3

Attachments:

Issue Links:

  • #15343 method demarcated with @Async isn't executed when precompiled

Referenced from: commits 3562cd7, b6c54c3

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 24, 2013

Juergen Hoeller commented

I've moved that executor null check to our proxy-based AsyncExecutionInterceptor now where we do want a strict check, allowing the AspectJ AbstractAsyncExecutionAspect to fall back to sync execution (as in 3.2.1).

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.