I looked through the documentation but couldn’t find if there is a way to specify a timeout for async operations spawned when using @Async annotated methods using Spring 3.0.
Is there a way to do that? I think this is pretty essential whenever making triggering an async computation.
Timeouts are not provided by the
@Asyncannotation, since the timeout should be decided by the caller of the function, not the function itself.I’m assuming you’re referring to the timeout on an
@Async-annotated method which returns a result. Such methods should return an instance ofFuture, and theget()method onFutureis used to specify the timeout.e.g.
and then