use of org.apache.openejb.core.timer.EjbTimerService in project tomee by apache.
the class EntityContainer method cancelTimers.
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// if we have a real timerservice, stop all timers. Otherwise, ignore...
if (primaryKey != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
use of org.apache.openejb.core.timer.EjbTimerService in project tomee by apache.
the class SingletonContainer method start.
@Override
public void start(final BeanContext info) throws OpenEJBException {
instanceManager.start(info);
final EjbTimerService timerService = info.getEjbTimerService();
if (timerService != null) {
timerService.start();
}
}
use of org.apache.openejb.core.timer.EjbTimerService in project tomee by apache.
the class EjbTimerImplSerializableTest method timerData.
public static CalendarTimerData timerData() throws Exception {
final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext("EJBWithTimer");
final EjbTimerService timer = context.getEjbTimerService();
final MethodContext ctx = context.getMethodContext(EJBWithTimer.class.getMethod("doSthg"));
final ScheduleData sd = ctx.getSchedules().iterator().next();
return new CalendarTimerData(1, (EjbTimerServiceImpl) timer, context.getDeploymentID().toString(), null, ctx.getBeanMethod(), sd.getConfig(), sd.getExpression(), false);
}
use of org.apache.openejb.core.timer.EjbTimerService in project tomee by apache.
the class StatelessContainer method start.
@Override
public void start(final BeanContext beanContext) throws OpenEJBException {
this.instanceManager.deploy(beanContext);
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null) {
timerService.start();
}
}
use of org.apache.openejb.core.timer.EjbTimerService in project tomee by apache.
the class CmpContainer method cancelTimers.
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// stop timers
if (primaryKey != null && beanContext.getEjbTimerService() != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
Aggregations