@Override public synchronized void start(final StartContext context) throws StartException { logger.debug("Starting timerservice for timedObjectId: " + getInvoker().getTimedObjectId()); final EJBComponent component = ejbComponentInjectedValue.getValue(); this.transactionManager = component.getTransactionManager(); this.tsr = component.getTransactionSynchronizationRegistry(); final TimedObjectInvoker invoker = timedObjectInvoker.getValue(); if (invoker == null) { throw MESSAGES.invokerIsNull(); } 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())); } } // restore the timers started = true; restoreTimers(timers); // register ourselves to the TimerServiceRegistry (if any) if (timerServiceRegistry != null) { timerServiceRegistry.registerTimerService(this); } }
@Override public synchronized void stop(final StopContext context) { // un-register ourselves to the TimerServiceRegistry (if any) if (timerServiceRegistry != null) { timerServiceRegistry.unRegisterTimerService(this); } suspendTimers(); timerPersistence.getValue().timerUndeployed(timedObjectInvoker.getValue().getTimedObjectId()); started = false; this.transactionManager = null; }
@Override public synchronized void stop(final StopContext context) { // un-register ourselves to the TimerServiceRegistry (if any) if (timerServiceRegistry != null) { timerServiceRegistry.unRegisterTimerService(this); } timerPersistence.getValue().timerUndeployed(timedObjectInvoker.getValue().getTimedObjectId()); started = false; this.transactionManager = null; IoUtils.safeClose(listenerHandle); listenerHandle = null; timerInjectedValue.getValue().purge(); // WFLY-3823 }
@Override public synchronized void start(final StartContext context) throws StartException { if (logger.isDebugEnabled()) { logger.debug("Starting timerservice for timedObjectId: " + getInvoker().getTimedObjectId()); } final EJBComponent component = ejbComponentInjectedValue.getValue(); this.transactionManager = component.getTransactionManager(); this.tsr = component.getTransactionSynchronizationRegistry(); final TimedObjectInvoker invoker = timedObjectInvoker.getValue(); if (invoker == null) { throw EjbLogger.ROOT_LOGGER.invokerIsNull(); } started = true; // register ourselves to the TimerServiceRegistry (if any) if (timerServiceRegistry != null) { timerServiceRegistry.registerTimerService(this); } listenerHandle = timerPersistence .getValue() .registerChangeListener(getInvoker().getTimedObjectId(), new TimerRefreshListener()); }