ejb3.1 timer

摘自

http://www.rainripple.com/articles/ejb3-1-timer-service.html

1.Timers默认会被持久化。

所以需要设置

设置persistent:

timerConfig.setPersistent(false);

@Schedule(persistent=false..

 

2.如果已经被持久化了,可以

 

清空JBOSS主目录\server\[default]\data文件夹即可。

 

3.例子

转自

http://www.infoq.com/cn/news/2010/02/jee6_ejb_31

@javax.ejb.Singleton 
public class ChatRoom {

   private java.util.Map<User,Collection<String>> userComments;
        
   @javax.ejb.Schedule(minute="1", hour="*") 

   public void cleanOutOldDataFromChatLogs() { 
      /** ... not reprinting all the existing code ... */
   }
}

猜你喜欢

转载自iloveblack.iteye.com/blog/1172754