Package javax.ejb

Examples of javax.ejb.TimerHandle


    @Test
    public void testCancelSimpleWhileTimeoutActive() throws NamingException, InterruptedException {
        InitialContext ctx = new InitialContext();
        SimpleTimerServiceBean bean = (SimpleTimerServiceBean)ctx.lookup("java:module/" + SimpleTimerServiceBean.class.getSimpleName());
        TimerHandle handle = bean.createTimer();
        Assert.assertTrue(bean.getTimerEntry().await(TIMER_CALL_WAITING_S, TimeUnit.SECONDS));
        //now the timeout is in progress cancel the timer
        handle.getTimer().cancel();
        bean.getTimerExit().countDown();
        Assert.assertFalse(SimpleTimerServiceBean.quickAwaitTimerCall());
        Assert.assertEquals(0, bean.getTimerCount());

    }
View Full Code Here


    @Test
    public void testCancelCalendarWhileTimeoutActive() throws NamingException, InterruptedException {
        InitialContext ctx = new InitialContext();
        CalendarTimerServiceBean bean = (CalendarTimerServiceBean)ctx.lookup("java:module/" + CalendarTimerServiceBean.class.getSimpleName());
        TimerHandle handle = bean.createTimer();
        Assert.assertTrue(bean.getTimerEntry().await(TIMER_CALL_WAITING_S, TimeUnit.SECONDS));
        //now the timeout is in progress cancel the timer
        handle.getTimer().cancel();
        bean.getTimerExit().countDown();
        Assert.assertFalse(CalendarTimerServiceBean.quickAwaitTimerCall());
        Assert.assertEquals(0, bean.getTimerCount());
    }
View Full Code Here

            throws
                IllegalStateException,
                NoSuchObjectLocalException,
                EJBException
        {
            TimerHandle handle = (TimerHandle)
                instance().call(new Callable() {
                     public Object call()
                     {
                         return timer.getHandle();
                     }
View Full Code Here

            throws
                IllegalStateException,
                NoSuchObjectLocalException,
                EJBException
        {
            TimerHandle handle = (TimerHandle)
                instance().call(new Callable() {
                     public Object call()
                     {
                         return timer.getHandle();
                     }
View Full Code Here

    * Cancels any scheduled {@link Future} corresponding to the passed <code>timer</code>
    * @param timer
    */
   protected void cancelTimeout(TimerImpl timer)
   {
      TimerHandle handle = timer.getTimerHandle();
      Future<?> scheduleFuture = this.scheduledTimerFutures.get(handle);
      if (scheduleFuture != null)
      {
         scheduleFuture.cancel(false);
      }
View Full Code Here

    */
   void addTimer(TimerImpl txtimer)
   {
      synchronized (timers)
      {
         TimerHandle handle = new TimerHandleImpl(txtimer);
         timers.put(handle, txtimer);
      }
   }
View Full Code Here

            throws
                IllegalStateException,
                NoSuchObjectLocalException,
                EJBException
        {
            TimerHandle handle = (TimerHandle)
                instance().call(new Callable() {
                     public Object call()
                     {
                         return timer.getHandle();
                     }
View Full Code Here

    * Cancels any scheduled {@link Future} corresponding to the passed <code>timer</code>
    * @param timer
    */
   protected void cancelTimeout(TimerImpl timer)
   {
      TimerHandle handle = timer.getTimerHandle();
      Future<?> scheduleFuture = this.scheduledTimerFutures.get(handle);
      if (scheduleFuture != null)
      {
         scheduleFuture.cancel(false);
      }
View Full Code Here

            throws
                IllegalStateException,
                NoSuchObjectLocalException,
                EJBException
        {
            TimerHandle handle = (TimerHandle)
                callInContext(new Callable() {
                        public Object call() {
                            return timer.getHandle();
                        }
                    });
View Full Code Here

    @Transactional
    public void cancel() {
        Payment payment = getInstance();
       
        TimerHandle handle = payment.getTimerHandle();
        payment.setTimerHandle(null);
        payment.setActive(false);
       
        try
        {
            handle.getTimer().cancel();
        }
        catch (NoSuchObjectLocalException nsole)
        {
            FacesMessages.instance().add("Payment already processed");
        }
View Full Code Here

TOP

Related Classes of javax.ejb.TimerHandle

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.