Package javax.ejb

Examples of javax.ejb.TimerService


     * Passes a message to the listener.
     * @param message - the message passed to the listener
     */
    public void onMessage(final Message message) {
        // Get the timer service
        TimerService timerService = messageDrivenContext.getTimerService();

        // Calling the timer service
        timerService.createTimer(FIRING_TIME, "Timer started by the onMessage() method");
    }
View Full Code Here


     * Tests the sessionContext by invoking "getTimerService".
     * @throws Exception if a problem occurs.
     */
    @SuppressWarnings("unused")
    protected void access01() throws Exception{
        TimerService ts = ctx.getTimerService();
    }
View Full Code Here

     * @throws Exception if a problem occurs
     */
    public static void checkJNDI() throws Exception{
        Context ctx = new InitialContext();

        TimerService ts = (TimerService) ctx.lookup("java:comp/TimerService");
        if (ts == null){
            throw new Exception("TimerService reference obtained using JNDI API is null.");
        }
    }
View Full Code Here

{
   private static Logger log = Logger.getLogger(JBossTimerServiceFactory.class);
  
   public TimerService createTimerService(TimedObjectInvoker invoker)
   {
      TimerService timerService = null;
      try
      {
         EJBTimerService service = getEJBTimerService();
         ObjectName objectName = new ObjectName(invoker.getTimedObjectId());
         org.jboss.ejb.txtimer.TimedObjectInvoker bridge = new TimedObjectInvokerBridge(invoker);
         TimerService delegate = service.createTimerService(objectName, null, bridge);
         timerService = new TimerServiceFacade(objectName, delegate);
      }
      catch (Exception e)
      {
         //throw new EJBException("Could not create timer service", e);
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

         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

      {
         // 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

            TimerHandleImpl handle = (TimerHandleImpl)i.next();
            try
            {
               TimedObjectId targetId = handle.getTimedObjectId();
               ContainerMBean container = (ContainerMBean)MBeanProxyExt.create(ContainerMBean.class, containerId, server);              
               TimerService timerService = container.getTimerService(targetId.getInstancePk());
               timerService.createTimer(handle.getFirstTime(), handle.getPeriode(), handle.getInfo());
            }
            catch (Exception e)
            {
               log.warn("Unable to restore timer record: " + handle, e);
            }
View Full Code Here

  /**
   * Returns the timer service.
   */
  public TimerService getTimerService()
  {
    TimerService service = _producer.getTimerService();
   
    if (service != null)
      return service;
   
    // ejb/0fj0
View Full Code Here

    } catch (Exception e) {
      log.log(Level.FINER, e.toString(), e);
    }
   
    try {
      TimerService timer = context.getTimerService();
     
      BeanBuilder<TimerService> timerBuilder
        = injectManager.createBeanFactory(TimerService.class);
     
      if (injectManager.getBeans(TimerService.class).size() == 0)
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.