Package javax.ejb

Examples of javax.ejb.TimerService


    * @ejb:interface-method view-type="remote"
    **/
   public byte[] startTimer(long pPeriod, Serializable info)
   {
      log.info("TimerSLSBean.startTimer(), 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), pPeriod, info);
      log.info("TimerSLSBean.startTimer(), create a timer: "+timer);
      byte[] handle = getHandle(timer);
      return handle;
   }
View Full Code Here


        final Collection<Timer> timers = new HashSet<>();
        for (final BeanContext c : module.getAppContext().getBeanContexts()) {
            if (c.getModuleContext() == module) { // filter by module
                if (c.getComponentType() != BeanType.STATEFUL) {
                    final TimerService timerService = getTimerService(null, c, true);
                    if (timerService == null) {
                        continue;
                    }
                    final Collection<Timer> beanTimers = timerService.getTimers();
                    timers.addAll(beanTimers);
                } else {
                    // for all instances
                    final TimerService timerService = getTimerService(null, c, true);
                    if (timerService == null) {
                        continue;
                    }
                    final Collection<Timer> beanTimers = timerService.getTimers();
                    timers.addAll(beanTimers);
                }
            }
        }
        return timers;
View Full Code Here

      {
         return;
      }

      // get hold of the timerservice since we need it to create the autotimers
      TimerService timerService = container.getTimerService();

      if (timerService instanceof org.jboss.ejb3.timerservice.extension.TimerService == false)
      {
         // can't do anything about this
         logger.warn("Cannot create auto timers for EJB: " + enterpriseBeanMetaData.getEjbName()
View Full Code Here

     
      AccessController.doPrivileged(new PrivilegedAction<Object>()
      {
         public Object run()
         {
            TimerService timerService = service.getTimerService(containerId, id);
            if (timerService != null && timerService.getTimers().isEmpty())
            {
               // Assuming that active timers do not include cancelled or expired ones.
               if (trace)
               {
                  log.trace("No active timers available for " + containerId + " and primary key " + id);
View Full Code Here

      {
         // jbcts-381
         return EJBTimerServiceImpl.FOR_NON_TIMED_OBJECT;
      }

      TimerService timerService = null;
      try
      {
         timerService = this.timerService.createTimerService(getJmxName(), pKey, this);
      }
      catch (Exception e)
View Full Code Here

         log.trace("Check whether all timers are cancelled or expired for this entity: " + ctx);
      }
      EJBTimerService service = m_container.getTimerService();
      ObjectName containerId = m_container.getJmxName();
      Object pKey = ctx.getId();
      TimerService timerService = service.getTimerService(containerId, pKey);
      if (timerService != null && timerService.getTimers().isEmpty())
      {
         // Assuming that active timers do not include cancelled or expired ones.
         if (trace)
         {
            log.trace("No active timers available for " + containerId + " and primary key " + pKey);
View Full Code Here

    * @see org.jboss.ejb3.timerservice.TimerServiceFactory#createTimerService(javax.management.ObjectName, org.jboss.ejb3.timerservice.TimedObjectInvoker)
    */
   @Override
   public TimerService createTimerService(Container container, TimedObjectInvoker invoker)
   {
      TimerService timerService = null;
      try
      {
         EJBTimerService service = getEJBTimerService();
         TimerService delegate = service.createTimerService(container.getObjectName(), null, invoker);
         timerService = new TimerServiceFacade(container, delegate);
      }
      catch (Exception e)
      {
         //throw new EJBException("Could not create timer service", e);
View Full Code Here

        timerService = null;
    }

    @Override
    protected TimerService delegate() {
        final TimerService timerService = this.timerService;
        if(timerService == null) {
            throw new IllegalStateException("TimerService is not started");
        }
        return timerService;
    }
View Full Code Here

      public TimerService createTimerService(ObjectName containerId, Object instancePk, Container container)
              throws IllegalStateException
      {
         try
         {
            TimerService timerService = mbeanEjbTimerService.createTimerService(containerId, instancePk, container);
            return timerService;
         }
         catch (Exception e)
         {
            log.error("Cannot createTimerService", e);
View Full Code Here

      public TimerService createTimerService(ObjectName containerId, Object instancePk, TimedObjectInvoker invoker)
              throws IllegalStateException
      {
         try
         {
            TimerService timerService = mbeanEjbTimerService.createTimerService(containerId, instancePk, invoker);
            return timerService;
         }
         catch (Exception e)
         {
            log.error("Cannot createTimerService", e);
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.