我想每两秒唤醒一次 ejb 计时器。为此,我正在创建ScheulerExpression作为下面的代码......
package com.fks.nclp.ejb.timer.service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.LocalBean;
import javax.ejb.ScheduleExpression;
import javax.ejb.Startup;
import javax.ejb.Timeout;
import javax.ejb.TimerConfig;
import javax.ejb.TimerService;
import com.sun.jersey.spi.resource.Singleton;
@LocalBean
@Singleton
@Startup
public class HelloWorldService {
    @Resource
    TimerService timerService;
    @PostConstruct
    public void initialize(){
            System.out.println("EJB PRE CONSTRUCT");
            ScheduleExpression expression = new ScheduleExpression();
            //SET TIMER TO 2 SEC            
            expression.hour("*");
            expression.minute("*");
            expression.second("*/2");
            timerService.createCalendarTimer(expression,new TimerConfig("TimerScheduler",false));
    }
    @Timeout
    public void startTimer(){
        System.out.println("THIS IS EJB TIMER PROGRAM");
    }
}
但是...... EJB 容器不会在每两秒后唤醒调度程序。
对此有何建议?我怎样才能使表情每两秒钟醒来一次。
谢谢,甘扬。