简体   繁体   English

如何创建一个非持久的EJB 3.1计时器?

[英]How do I create a non-persistent EJB 3.1 Timer?

Using NetBeans 7.1 / GlassFish 3.1, I created a new TimerSessionBean. 使用NetBeans 7.1 / GlassFish 3.1,我创建了一个新的TimerSessionBean。

@Stateless
public class NewTimerSessionBean implements NewTimerSessionBeanLocal {

    @Schedule(minute = "*", second = "0", dayOfMonth = "*", month = "*", year = "*", hour = "9-17", dayOfWeek = "Mon-Fri")
        @Override
        public void myTimer() {
            System.out.println("Timer event: " + new Date());
        }
}

How can I declare that the timer is non-persistent? 如何声明计时器为非持久性计时器? http://www.theserverside.com/news/1363578/EJB-31-A-Significant-Step-Towards-Maturity says there is a method isPersistent but it belongs to the Timer interface. http://www.theserverside.com/news/1363578/EJB-31-A-Significant-Step-Towards-Maturity表示有一个isPersistent方法,但它属于Timer接口。

I came to this question after reading a description of potential problems with EJB timers in this article: http://www.coderanch.com/t/477104/EJB-JEE/java/Java-EE-timer-service-periodical 阅读本文中有关EJB计时器的潜在问题的说明后,我遇到了这个问题: http : //www.coderanch.com/t/477104/EJB-JEE/java/Java-EE-timer-service-periodical

根据文章中,你可以通过添加持久=假@Schedule上实现这一目标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Websphere的集群环境中使用EJB 3.1自动非持久计时器? - How to Use EJB 3.1 Automatic Non-Persistent Timer in Clustered Environment on Websphere? 是否可以创建 Singleton 非持久 ejb 计时器? - is it possible to create Singleton non-persistent ejb timer? 如何在JPA实体中创建非持久字段? - How to create a non-persistent Field in an JPA Entity? 如何使用eclipse kepler创建EJB 3.1项目? - How do I create an EJB 3.1 Project with eclipse kepler? 如何删除具有持久性/非持久性收集字段为null的对象? - How To Delete an Object With Persistent/Non-Persistent Collection Field That is null? 如何配置非持久性 Ignite 以防止交换? - How to configure non-persistent Ignite to prevent swapping? 如何使EJB Timer Persistent为false - How to make EJB Timer Persistent to false 将持久性activemq消息更改为非持久性时,为什么不能提高性能? - Why can't I get performance boost while changing persistent activemq messages to non-persistent? Java 非持久但可序列化的变量 - Java non-persistent but serializable variable 与非持久实体的ManyToOne关系 - ManyToOne relationship with non-persistent entity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM