Package javax.ejb

Examples of javax.ejb.Timer.cancel()


        //Verifies if the new timer was added to the timers list
        if(ts.getTimers().size() < 1){
            throw new IllegalStateException("The Timers Collection must have at least one timer. It was created in this method.");
        }
        //Cancels the timer
        t.cancel();
    }

    /**
     * Checks if a timer service reference can be obtained using the JNDI API.
     * @throws Exception if a problem occurs
View Full Code Here


        Collection<Timer> timers = timer.getTimers();
        // stop all timers
        boolean cancelled = false;
        for(Iterator<Timer> it = timers.iterator(); it.hasNext(); ) {
            Timer t = it.next();
            t.cancel();
            cancelled = true;
            log.info("Stopped snapshot timer...");
        }
        return cancelled;
    }
View Full Code Here

        Collection<Timer> timers = timer.getTimers();
        // stop all timers
        boolean cancelled = false;
        for(Iterator<Timer> it = timers.iterator(); it.hasNext(); ) {
            Timer t = it.next();
            t.cancel();
            cancelled = true;
            log.info("Stopped snapshot timer...");
        }
        return cancelled;
    }
View Full Code Here

        long ts = (new Date()).getTime() + TIMER_INIT_TIME_MS;
        Timer timer1 = bean1.getTimerService().createIntervalTimer(new Date(ts), TIMER_TIMEOUT_TIME_MS, timerConfig);
        Assert.assertTrue(AnnotationTimerServiceBean.awaitTimerCall());
        bean1.resetTimerServiceCalled();
        Assert.assertTrue(AnnotationTimerServiceBean.awaitTimerCall());
        timer1.cancel();
       
        TimedObjectTimerServiceBean bean2 = (TimedObjectTimerServiceBean) ctx.lookup("java:module/" + TimedObjectTimerServiceBean.class.getSimpleName());
        bean2.resetTimerServiceCalled();
        Timer timer2 = bean2.getTimerService().createIntervalTimer(TIMER_INIT_TIME_MS, TIMER_TIMEOUT_TIME_MS, timerConfig);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());
View Full Code Here

        bean2.resetTimerServiceCalled();
        Timer timer2 = bean2.getTimerService().createIntervalTimer(TIMER_INIT_TIME_MS, TIMER_TIMEOUT_TIME_MS, timerConfig);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());
        bean2.resetTimerServiceCalled();
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());
        timer2.cancel();
    }

}
View Full Code Here

        Collection<Timer> timers = timer.getTimers();
        // stop all timers
        boolean cancelled = false;
        for(Iterator<Timer> it = timers.iterator(); it.hasNext(); ) {
            Timer t = it.next();
            t.cancel();
            cancelled = true;
            log.info("Stopped snapshot timer...");
        }
        return cancelled;
    }
View Full Code Here

     */
    public void stopTimers () {
  for (Iterator i = ctx.getTimerService().getTimers().iterator ();
       i.hasNext ();) {
      Timer timer = (Timer)i.next();
      timer.cancel ();
  }
    }

    /**
     * Handle the timeout of a timer.
View Full Code Here

     */
    public void stopTimers () {
  for (Iterator i = ctx.getTimerService().getTimers().iterator ();
       i.hasNext ();) {
      Timer timer = (Timer)i.next();
      timer.cancel ();
  }
    }

    /**
     * Handle the timeout of a timer.
View Full Code Here

      TimedMockObject to = new TimedMockObject();
      TimerService service = createTimerService(to);
      Timer timer = service.createTimer(500, null);

      txManager.begin();
      timer.cancel();
      txManager.rollback();

      assertEquals("Expected one txtimer", 1, service.getTimers().size());
      sleep(1000);
      assertEquals("TimedObject not called", 1, to.getCallCount());
View Full Code Here

      Timer timer = service.createTimer(500, 500, null);
      assertEquals("Expected one txtimer", 1, service.getTimers().size());
      sleep(2000);
      assertTrue("TimedObject not called enough", 1 < to.getCallCount());

      timer.cancel();
      assertEquals("Expected no txtimer", 0, service.getTimers().size());
   }

   public void testMultipleEventExpire() throws Exception
   {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.