thanks for your answer, I solved the problem by using an action to update the 
timer due date .
here is the action 

  | .....
  | public class UpdatingTimerActionHandler implements ActionHandler {
  | 
  |     private static final long serialVersionUID = 1L;
  | 
  |     
  | 
  |     /**
  |      * update 
  |      */
  |     public void execute(ExecutionContext context) throws Exception {
  |             
  |             System.out
  |             .println("start timer updating");
  |             String timerName = "actionTimer";
  |             String delay = 
context.getContextInstance().getVariable("action_delay").toString();
  |             //System.out.println("new delay : "+ delay);
  |             if (delay!=null && !delay.equals("")){
  |                     try{
  |                             SchedulerSession schedulerSession = 
context.getJbpmContext().getSchedulerSession();
  |                             Duration duration = new Duration(delay);
  |                     Date newDueDate = new BusinessCalendar().add(new 
Date(), duration);
  |                             List timers = 
schedulerSession.findTimersByName(timerName, context.getToken());
  |                 for(Object o : timers) {
  |                     Timer timer = (Timer)o;
  |                     log.info("Timer '" + timer.getName() + "' due date is " 
+ timer.getDueDate());
  |                     try{                            
  |                         timer.setDueDate(newDueDate);
  |                     }catch(Exception e) {
  |                         throw new Exception("Timer '" + timer.getName() + 
"' due date was not updated to " + 
  |                                 newDueDate + "': " + e);
  |                     }
  |                     schedulerSession.saveTimer(timer);
  |                     log.info("Timer '" + timer.getName() + "' due date 
updated to " + timer.getDueDate());
  |                 }
  |                             }
  |                             catch(Exception ex){
  |                                     ex.printStackTrace();
  |                             }
  |             }
  |                     System.out
  |                     .println("finish timer updating");
  |     }
  |     public Log log = LogFactory.getLog(this.getClass());
  | 
  | }
  | 
thanks again

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099158
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to