Annotation @Schedule exécuter toutes les quelques minutes (ou secondes)

Je voudrais essayer d'utiliser l'annotation @Schedule de la manière suivante:

public class MyTestServlet extends HttpServlet {
    private static JcanLogger LOG = JcanLoggerFactory.getLogger(ServiceTestServlet.class);

    @EJB CronService cronService;

    public void service(HttpServletRequest req, HttpServletResponse resp) throws .... {
    ....
    cronService.iLive(); 
}
---
    @Local //because the ejb is in a servlet (there is no other jvm)
public interface CronService {

    public void iLive();
    public void runsEveryMinute();
}
---
@Singleton
public class CronServiceBean implements CronService {
    private static final JcanLogger LOG = JcanLoggerFactory.getLogger(CronServiceBean.class);

    @Schedule(minute="*")
    public void runsEveryMinute() {
        LOG.info(" runs EveryMinute ");
    }

    public void iLive() {
        LOG.info("iLive");

    }
 ---
 LOG
 ... 
 CronServiceBean:34  ] iLive

Basé sur le journal, le CronService vivre et bien, mais la tâche planifiée 'runsEveryMinute' ne fonctionne pas.

Comment devrait-il travailler à l'aide d'un EJB tâche planifiée?

OriginalL'auteur cscsaba | 2012-07-14