[jboss-user] [EJB 3.0] - design pattern for canceling an EJB3 timer

ajay662 do-not-reply at jboss.com
Thu May 3 17:26:42 EDT 2007


I need some advice on how to cancel an active EJB3 timer. Currently below is the flow of things in my application

1. Client schedules a task via SLSB.
  | 2. SLSB validates task parameters and queues a JMS msg, passing it the Task Object.
  | 3. Corresponding MDB gets the JMS message and depending on scheduling params starts a timer for the task.
  | 4. On timer expiration the @Timeout method on MDB is called, which executes the task

In between 1 and 4, client my request to cancel this task via SLSB. In this case SLSB will set the 'cancelRequested' flag on the Task Object.

In 4 above, the MDB @Timeout method checks if the 'cancelRequested' flag is set. If cancel is requested it wouldn't perform the task and if this timer was of a recurring nature it will also cancel the timer.
  | 
Problem is user has to wait till next timer expiration (i.e. until @Timeout method is called) to see if the task was successfully canceled. I need a way to cancel the timer right away when user requests to cancel the task. In order to cancel the timer, I need the TimerHandle. How can I access the TimerHandle to be able to cancel the timer right away?

Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043003#4043003

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043003



More information about the jboss-user mailing list