@Override public Collection<Timer> getAllTimers() throws IllegalStateException, EJBException { // query the registry if (this.timerServiceRegistry != null) { return this.timerServiceRegistry.getAllActiveTimers(); } // If we don't have the timer service registry (for whatever reason), we just invoke the getTimers() so that it can // do the necessary state checks before returning an empty collection (since this is a non-functional timer service) return this.getTimers(); }
@Override public void start(StartContext startContext) throws StartException { if (this.timerServiceRegistry != null) { this.timerServiceRegistry.registerTimerService(this); } }
@Override public void stop(StopContext stopContext) { if (this.timerServiceRegistry != null) { this.timerServiceRegistry.unRegisterTimerService(this); } }
final TimerServiceRegistry timerServiceRegistry = EjbDeploymentMarker.isEjbDeployment(deploymentUnit) ? new TimerServiceRegistry() : 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; IoUtils.safeClose(listenerHandle); listenerHandle = null; timerInjectedValue.getValue().purge(); //WFLY-3823 }
/** * {@inheritDoc} */ @Override public Collection<Timer> getAllTimers() throws IllegalStateException, EJBException { // query the registry if (this.timerServiceRegistry != null) { return this.timerServiceRegistry.getAllActiveTimers(); } // if we don't have the registry (shouldn't really happen) which stores the timer services applicable for the EJB module to which // this timer service belongs, then let's at least return the active timers that are applicable only for this timer service return this.getTimers(); }
@Override public synchronized void start(final StartContext context) throws StartException { if (EJB3_TIMER_LOGGER.isDebugEnabled()) { EJB3_TIMER_LOGGER.debug("Starting timerservice for timedObjectId: " + getInvoker().getTimedObjectId()); } final EJBComponent component = ejbComponentInjectedValue.getValue(); this.tsr = component.getTransactionSynchronizationRegistry(); final TimedObjectInvoker invoker = timedObjectInvoker.getValue(); if (invoker == null) { throw EJB3_TIMER_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()); }