Package org.jboss.ejb3.timerservice.mk2

Examples of org.jboss.ejb3.timerservice.mk2.TimerServiceImpl$Task


        // and scheduling the timer task
        for (final TimerImpl activeTimer : restorableTimers) {

            if (activeTimer.isAutoTimer()) {
                boolean found = false;
                final CalendarTimerEntity entity = (CalendarTimerEntity) activeTimer.getPersistentState();
                //so we know we have an auto timer. We need to try and match it up with the auto timers.
                ListIterator<ScheduleTimer> it = newAutoTimers.listIterator();
                while (it.hasNext()) {
                    ScheduleTimer timer = it.next();
                    final String methodName = timer.getMethod().getName();
                    final String[] params = new String[timer.getMethod().getParameterTypes().length];
                    for (int i = 0; i < timer.getMethod().getParameterTypes().length; ++i) {
                        params[i] = timer.getMethod().getParameterTypes()[i].getName();
                    }
                    if (doesTimeoutMethodMatch(entity.getTimeoutMethod(), methodName, params)) {

                        //the timers have the same method.
                        //now lets make sure the schedule is the same
                        if (this.doesScheduleMatch(entity.getScheduleExpression(), timer.getScheduleExpression())) {
                            it.remove();
                            found = true;
                            break;
                        }
                    }
View Full Code Here


            if (ineligibleTimerStates.contains(persistedTimer.getTimerState())) {
                continue;
            }
            TimerImpl activeTimer = null;
            if (persistedTimer.isCalendarTimer()) {
                CalendarTimerEntity calendarTimerEntity = (CalendarTimerEntity) persistedTimer;

                // create a timer instance from the persisted calendar timer
                activeTimer = new CalendarTimer(calendarTimerEntity, this);
            } else {
                // create the timer instance from the persisted state
View Full Code Here

    /**
     * Creates and return a new persistent state of this timer
     */
    @Override
    protected TimerEntity createPersistentState() {
        return new CalendarTimerEntity(this);
    }
View Full Code Here

      this.nextExpiration = persistedCalendarTimer.getNextDate();
      // auto-timer related attributes
      if (persistedCalendarTimer.isAutoTimer())
      {
         this.autoTimer = true;
         TimeoutMethod timeoutMethodInfo = persistedCalendarTimer.getTimeoutMethod();
         this.timeoutMethod = this.getTimeoutMethod(timeoutMethodInfo);
         if (this.timeoutMethod == null)
         {
            throw new IllegalStateException("Could not find timeout method: " + timeoutMethodInfo);
         }
View Full Code Here

      this.nextExpiration = persistedCalendarTimer.getNextDate();
      // auto-timer related attributes
      if (persistedCalendarTimer.isAutoTimer())
      {
         this.autoTimer = true;
         TimeoutMethod timeoutMethodInfo = persistedCalendarTimer.getTimeoutMethod();
         this.timeoutMethod = this.getTimeoutMethod(timeoutMethodInfo);
         if (this.timeoutMethod == null)
         {
            throw new IllegalStateException("Could not find timeout method: " + timeoutMethodInfo);
         }
View Full Code Here

        // set the next expiration (which will be available in the persistent state)
        this.nextExpiration = persistedCalendarTimer.getNextDate();
        // auto-timer related attributes
        if (persistedCalendarTimer.isAutoTimer()) {
            this.autoTimer = true;
            TimeoutMethod timeoutMethodInfo = persistedCalendarTimer.getTimeoutMethod();
            this.timeoutMethod = this.getTimeoutMethod(timeoutMethodInfo);
            if (this.timeoutMethod == null) {
                throw new IllegalStateException("Could not find timeout method: " + timeoutMethodInfo);
            }
View Full Code Here

      {
         return;
      }

      // get the persistent entity from the timer
      TimerEntity timerEntity = timer.getPersistentState();

      // TODO: Now all that bolierplate for tx management (which
      // needs to go once we have the timer service "managed")
      Transaction previousTx = null;
      boolean newTxStarted = false;
      try
      {
         previousTx = this.transactionManager.getTransaction();
         // we persist with REQUIRED tx semantics
         // if there's no current tx in progress, then create a new one
         if (previousTx == null)
         {
            this.startNewTx();
            newTxStarted = true;
         }

         EntityManager em = this.getCurrentEntityManager();
         // merge the state
         TimerEntity mergedTimerEntity = em.merge(timerEntity);

         // do the actual persistence
         em.persist(mergedTimerEntity);

      }
View Full Code Here

      }
      if (timers.size() > 1)
      {
         throw new EJBException("More than one timer found for TimerHandle: " + timerHandle);
      }
      TimerEntity timerEntity = timers.get(0);
      if (timerEntity.isCalendarTimer())
      {
         return new CalendarTimer((CalendarTimerEntity) timerEntity, this);
      }
      return new TimerImpl(timerEntity, this);
View Full Code Here

    * Creates and returns a new persistent state of this timer
    * @return
    */
   protected TimerEntity createPersistentState()
   {
      return new TimerEntity(this);
   }
View Full Code Here

      {
         return;
      }

      // get the persistent entity from the timer
      TimerEntity timerEntity = timer.getPersistentState();

      // TODO: Now all that bolierplate for tx management (which
      // needs to go once we have the timer service "managed")
      Transaction previousTx = null;
      boolean newTxStarted = false;
      try
      {
         previousTx = this.transactionManager.getTransaction();
         // we persist with REQUIRED tx semantics
         // if there's no current tx in progress, then create a new one
         if (previousTx == null)
         {
            this.startNewTx();
            newTxStarted = true;
         }

         EntityManager em = this.getCurrentEntityManager();
         // merge the state
         TimerEntity mergedTimerEntity = em.merge(timerEntity);

         // do the actual persistence
         em.persist(mergedTimerEntity);

      }
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.timerservice.mk2.TimerServiceImpl$Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.