EJB programming & troubleshooting: To call a cleanup method after 10 sec in a stateless session bea
Hi all, I have a stateless session bean.In its interceptor i call a cleanup method.That means cleanup is performed only when any action is performed.Now i want that the cleanup method to be called after every 10 sec even if no action is performed.Can anybody plz help me? Regards, Mansi
- Posted by: Mansi Sachar
- Posted on: October 08 2008 07:27 EDT
- Re: To call a cleanup method after 10 sec in a stateless session bea by Nicke G on October 08 2008 15:44 EDT
- Re: To call a cleanup method after 10 sec in a stateless session by anish mathur on October 08 2008 21:36 EDT
Use a timer service that invokes the cleanup method with a frequency of 10 secs: http://www.javabeat.net/articles/3-ejb-30-timer-services-an-overview-1.html (That is of course under the assumption that cleaning after each "normal" invocation is not enough) /N
The EJB Timer can be used, but you cannot relay on EJB Timer for short time interval like 10 sec. It is only good for long time interval and also in the scenario where slight variation in interval time is acceptable.