我有以下功能来停止我的调度程序:
import javax.ejb.Timer;
// call this remote method with the Timer info that has to be canceled
@AccessTimeout(value = 20, unit = TimeUnit.MINUTES)
public void cancelTimer(String timerInfo) {
try {
for (Timer timer : timerService.getTimers()) {
if (timerInfo.equals(timer.getInfo())) {
timer.cancel();
}
}
} catch (Exception e) {
}
}
将调用:
cancelTimer("scheduleImagesFromFolder");
但现在我的问题是: 如何重新启用计划?
我的Timer.class是 javax.ejb.Timer