Question

E.g. I want to call the @Asynchronous fire-and-forget method of service. Are there any guarantees of "firing" of this method? What will happen e.g. when server is stopped before actual firing of @Asynchronous method? Will it be fired on the next start of application? Is it possible to use other than the thread-pool implementation of @Asynchronous? Can it act as JMS queue (in persistent way)? Should I use JMS for persistence?

Seems that we can't use @Asynchronous in any reliable system, because it doesn't provide guarantee of firing...

P.S. One possible option is to use persistent Timer's to make deferred calls. Is it good idea?

Was it helpful?

Solution

There are no transactional or persistence guarantees for @Asynchronous methods. I agree that this makes fire-and-forget methods very limited. I do think persistent timers are a reasonable alternative for asynchronously executing work if you need to guarantee it will run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top