Package javax.ejb

Examples of javax.ejb.TimerService


    * This is not allowed on the remote interface.
    * @ejb.interface-method view-type="both"
    **/
   public Object createTimerReturnHandle(long duration)
   {
      TimerService timerService = context.getTimerService();
      Timer timer = timerService.createTimer(duration, null);
      return timer.getHandle();
   }
View Full Code Here


   /**
    * @ejb.interface-method view-type="both"
    **/
   public List getTimers()
   {
      TimerService timerService = context.getTimerService();

      ArrayList handles = new ArrayList();
      Iterator it = timerService.getTimers().iterator();
      while (it.hasNext())
      {
         Timer timer = (Timer) it.next();
         handles.add(timer.getHandle().toString());
      }
View Full Code Here

   public void initTimer(int msgID, Queue replyTo)
   {
      try
      {
         TimerService ts = messageContext.getTimerService();
         ReplyInfo info = new ReplyInfo(msgID, replyTo);
         Timer timer = ts.createTimer(timerTimeout, info);
         log.info("Timer created with a timeout: " + timerTimeout
            + " and with info: " + msgID
            + ", handle: "+timer.getHandle());
      }
      catch (Exception e)
View Full Code Here

      return startSingleTimer(pPeriod,"TimerSLSBean.startSingleTimer");
   }

   public byte[] startSingleTimer(long pPeriod, Serializable info)
   {
      TimerService ts = context.getTimerService();
      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }
View Full Code Here

      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }

   public byte[] startTimer(long pPeriod)
   {
      TimerService ts = context.getTimerService();
      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }
View Full Code Here

      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }

   public byte[] startTimer(long pPeriod, Serializable info)
   {
      TimerService ts = context.getTimerService();
      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }
View Full Code Here

      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }

   public void stopTimer(byte[] handle)
   {
      TimerService ts = context.getTimerService();
      throw new EJBException("startSingleTimer.getTimerService should have failed");
   }
View Full Code Here

    * @ejb:interface-method view-type="remote"
    **/
   public void startSingleTimer(long pPeriod)
   {
      mLog.info("TimerEntityBean.startSingleTimer(), try to get a Timer Service from the Entity Context");
      TimerService lService = mContext.getTimerService();
      mLog.info("TimerEntityBean.startSingleTimer(), create a timer if not already done");
      if (sTimer == null)
      {
         sTimer = lService.createTimer(new Date(new Date().getTime() + pPeriod), "TimerEntityBean");
         sCounter = 0;
      }
      else
      {
         throw new EJBException("Timer is already set");
View Full Code Here

    * @ejb:interface-method view-type="remote"
    **/
   public void startTimer(long pPeriod)
   {
      mLog.info("TimerEntityBean.startTimer(), try to get a Timer Service from the Entity Context");
      TimerService lService = mContext.getTimerService();
      mLog.info("TimerEntityBean.startTimer(), create a timer if not already done");
      if (sTimer == null)
      {
         sTimer = lService.createTimer(new Date(new Date().getTime() + pPeriod), pPeriod, "TimerEntityBean");
         sCounter = 0;
      }
      else
      {
         throw new EJBException("Timer is already set");
View Full Code Here

    * @ejb:interface-method view-type="remote"
    **/
   public byte[] startSingleTimer(long pPeriod, Serializable info)
   {
      log.info("TimerSLSBean.startSingleTimer(), try to get a Timer Service from the Session Context");
      TimerService ts = context.getTimerService();
      long exp = System.currentTimeMillis() + pPeriod;
      Timer timer = ts.createTimer(new Date(exp), info);
      log.info("TimerSLSBean.startSingleTimer(), create a timer: "+timer);
      byte[] handle = getHandle(timer);
      return handle;
   }
View Full Code Here

TOP

Related Classes of javax.ejb.TimerService

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.