this.classLoader = classLoader;
}
@Override
public synchronized void start(final StartContext context) throws StartException {
final TimerServiceFactory timerServiceFactory = timerServiceFactoryInjectedValue.getValue();
final EJBComponent component = ejbComponentInjectedValue.getValue();
final TimedObjectInvoker invoker;
if(component instanceof SingletonComponent) {
invoker = new SingletonTimedObjectInvokerImpl((SingletonComponent) component, classLoader);
} else if(component instanceof StatelessSessionComponent) {
invoker = new StatelessTimedObjectInvokerImpl((StatelessSessionComponent) component, classLoader);
} else {
throw new StartException("TimerService can only be used with singleton and stateless components");
}
final org.jboss.ejb3.timerservice.api.TimerService timerService = (org.jboss.ejb3.timerservice.api.TimerService) timerServiceFactory.createTimerService(invoker);
final List<ScheduleTimer> timers = new ArrayList<ScheduleTimer>();
for(Map.Entry<Method, List<AutoTimer>> entry : autoTimers.entrySet()) {
for(AutoTimer timer : entry.getValue()) {
timers.add(new ScheduleTimer(entry.getKey(), timer.getScheduleExpression(), timer.getTimerConfig()));
}
}
timerServiceFactory.restoreTimerService(timerService, timers);
this.timerService = timerService;
}