Rename jee7schedule -> jee7

This commit is contained in:
Grzegorz Piwowarek
2016-10-23 19:13:21 +02:00
parent 9055ecbc6f
commit 90ca609762
20 changed files with 14 additions and 21 deletions

View File

@@ -0,0 +1,31 @@
package com.baeldung.timer;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.*;
import javax.enterprise.event.Event;
import javax.inject.Inject;
/**
* author: Cristian Chiovari
*/
@Startup
@Singleton
public class ProgrammaticAtFixedRateTimerBean {
@Inject
Event<TimerEvent> event;
@Resource
TimerService timerService;
@PostConstruct
public void initialize() {
timerService.createTimer(0,1000, "Every second timer");
}
@Timeout
public void programmaticTimout(Timer timer) {
event.fire(new TimerEvent(timer.getInfo().toString()));
}
}