[jboss-user] [JBoss jBPM] - Re: Exception on Timer-Execution under Weblogic

syngolis do-not-reply at jboss.com
Wed Jul 4 17:53:12 EDT 2007


After all...I found a possibillity to solve this problem...Here comes a question for the developers:

The error is thrown in Timerservicebean. First, the EJB Timer becomes cancled in 'cancelTimersByName'. Afterwards method  'deleteTimersForProcessInstance' is called and while executing TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo(); an error is thrown (in weblogic not in jboss), because there is no timer object for operation left. 

I don't understand this behaviour...so I insert a try...catch block in the second method and all works fine.

Can somebody explain it to me?

Here are the methods (with my 'correction')
  
  | public void cancelTimersByName(String timerName, Token token) {  
  | 	// TODO make the scanning of timers for cancellation optional by only deleting the timerjobs in the db.
  |   // of course, the corresponding ejb timer notifications have to be ignored. 
  | 
  | log.debug("cancelling timers with name "+timerName+" from the ejb timer service");
  | 
  | 	TimerService timerService = sessionContext.getTimerService();
  | 
  |   Iterator iter = timerService.getTimers().iterator();
  | 
  |   while (iter.hasNext()) {
  | 	  javax.ejb.Timer ejbTimer = (javax.ejb.Timer) iter.next();
  |     if (ejbTimer.getInfo() instanceof TimerInfo) {
  |   	  TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
  |       if (timerInfo.matchesName(timerName, token)) {
  |     	  ejbTimer.cancel();
  |       }
  |     }
  |   }       
  | }
  | 
 


  | public void deleteTimersForProcessInstance(ProcessInstance processInstance) {
  | 
  | // TODO make the scanning of timers for cancellation optional by only deleting the timerjobs in the db.
  | // of course, the corresponding ejb timer notifications have to be ignored. 
  | 
  | 	log.debug("deleting timers for process instance "+processInstance+" from the ejb timer service");         
  |   TimerService timerService = sessionContext.getTimerService();    
  |   Iterator iter = timerService.getTimers().iterator();
  |  
  |   while (iter.hasNext()) {      
  |   	javax.ejb.Timer ejbTimer = (javax.ejb.Timer) iter.next();
  |     try {
  |     	if (ejbTimer.getInfo() instanceof TimerInfo) {                    
  |       	TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();              
  |         if (timerInfo.matchesProcessInstance(processInstance)) {                
  |         	ejbTimer.cancel();
  |         }
  |       }
  |     } catch (Exception e) {
  |   	  System.out.println("CATCH!");
  |     }
  | }
  | 




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

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



More information about the jboss-user mailing list