[jboss-user] [JBoss jBPM] - Re: Threads and jbpm

jcarlos_andia do-not-reply at jboss.com
Fri Feb 8 17:30:18 EST 2008


Thanks for the response kukeltje.

I have this code for the timer:


  |                 Calendar cal=Calendar.getInstance();
  |                 BusinessCalendar bc=new BusinessCalendar();
  | 		Duration duration=new Duration("60 seconds");
  | 		Date dueDate=bc.add(cal.getTime(), duration);
  | 		
  | 		Delegation delegate=new Delegation("com.jotatech.vgrc.action.visual.MyActionHandler");
  | 		delegate.setProcessDefinition(bpmProject);
  | 		
  | 		Action myAction=new Action(delegate);
  | 		myAction.setName("[ACTION]");
  | 		myAction.setProcessDefinition(bpmProject);
  | 		bpmProject.addAction(myAction);
  | 				
  | 		Timer myTimer=new Timer();
  | 		myTimer.setName("[TIMER] "+myState.getName());
  | 		myTimer.setDueDate(dueDate);
  | 		myTimer.setRepeat("3 seconds");
  | 		myTimer.setRetries(3);
  | 		myTimer.setGraphElement(myState);
  | 		myTimer.setAction(myAction);
  | 		myTimer.setProcessInstance(myProcesInstance);
  | 		
  | 		log.info("Adding a timer to state {0} with dueDate {1}...",myState,myTimer.getDueDate());			
  | 		jbpmContext.getServices().getSchedulerService().createTimer(myTimer);
  | 

And the action:


  | public class MyActionHandler implements ActionHandler{
  | 	
  | 	private static final long serialVersionUID = -7574831777028763706L;
  | 
  | 	@Logger
  | 	private Log log;
  | 	
  | 	public void execute(ExecutionContext context) throws Exception{
  | 		log.info("EXECUTING ...");
  | 		System.out.println("EXECUTING ...");
  | 	}
  | }
  | 

The execute method is not called but the retries goes from 3 to 0 when the dueDate is reached. Any clue? I assign the timer to the processInstance, is there any way to assign it to a processDefinition?. Thanks in advance.  

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

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



More information about the jboss-user mailing list