use of org.apache.openejb.core.timer.TimerServiceImpl in project tomee by apache.
the class BaseContext method getTimerService.
public TimerService getTimerService() throws IllegalStateException {
doCheck(Call.getTimerService);
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext beanContext = threadContext.getBeanContext();
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService == null) {
throw new IllegalStateException("This ejb does not support timers " + beanContext.getDeploymentID());
} else if (!timerService.isStarted()) {
try {
timerService.start();
} catch (final OpenEJBException e) {
throw new IllegalStateException(e);
}
}
return new TimerServiceImpl(timerService, threadContext.getPrimaryKey(), beanContext.getEjbTimeout()) {
@Override
public Collection<Timer> getAllTimers() throws IllegalStateException, EJBException {
// allowed here
return Timers.all();
}
};
}
Aggregations