Discussions

EJB programming & troubleshooting: To call a cleanup method after 10 sec in a stateless session bea

  1. 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
  2. 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
  3. 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.