Reputation: 519
I'm just experimenting a bit with the async possibilities in the Spring framework and I'm asking myself how to get an notification when the async function call is done. Is there any callback functionality or something like that?
Upvotes: 0
Views: 757
Reputation: 16050
You can have your @Async
method return a Future
through which you can obtain return values:
@Async
public Future<Something> findSomethingAsync( final int id )
{
Something s = ...
return new AsyncResult<Something>( s );
}
Once the async method has completed, the Future
's isDone()
method will be true, and you can future.get()
the result.
Cheers,
Upvotes: 2