/** * Returns the {@link TimerService} associated with this container. * * @throws UnsupportedOperationException If this container corresponds to a stateful session bean */ @Override public TimerService getTimerService() { if (this.isStatefulBean()) { throw new UnsupportedOperationException("stateful bean doesn't support TimerService (EJB3 18.2#2)"); } return this.timerService; }
/** * Restores the timers after this container has fully started, thus * ensuring that any invocations on this container through the restored * timers are handled successfully * <p> * This method skips timerservice restoration of stateful session beans * </p> * * @see org.jboss.ejb3.EJBContainer#afterStart() */ @Override protected void afterStart() { super.afterStart(); // restore timerservice for non-stateful beans if (this.isStatefulBean() == false) { restoreTimerService(); } }
/** * Creates a {@link TimerService} for this container. * {@link TimerService} creation is skipped for stateful session beans, since * stateful session beans do not support timerservice * * @see EJBContainer#create() */ @Override public void create() throws Exception { super.create(); // for non-stateful beans, create timer service if (this.isStatefulBean() == false) { // just create the timerservice. Restoring of // any timers, will be done in afterStart(), once the container has fully started // (to allow for timeout method invocations) this.timerService = this.createTimerService(); } }