Rename jee7schedule -> jee7
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user