Ryan Peterson [
http://community.jboss.org/people/rrpeterson] created the discussion
"Re: Change a Timer length/period at runtime possible?"
To view the discussion, visit:
http://community.jboss.org/message/634065#634065
--------------------------------------------------------------
After getting some help from krisv (thanks again btw!) I think I'm closer, but still
not quite able to get this to work.
I've tried canceling the old timer (canceling portion works great), but setting up the
new timer seems to give issues.
The route I'm trying is:
((TimerNodeInstance) nodeInstance).cancel();
// create timerInstance
TimerInstance timerInstance = new TimerInstance();
timerInstance.setDelay(TimeUtils.parseTimeString("5s")); // hard-code to X
seconds
timerInstance.setPeriod(0); // hard-code to a period of 0
then I register the new timerInstance with the processInstance:
((InternalProcessRuntime)((WorkflowProcessInstance)
nodeInstanceContainer).getKnowledgeRuntime().getProcessRuntime()).getTimerManager().registerTimer(timerInstance,
(org.jbpm.process.instance.ProcessInstance) nodeInstanceContainer);
Lastly I set the timerInstanceId into the TimerNodeInstance:
((TimerNodeInstance) nodeInstance).internalSetTimerId(timerInstance.getId());
My trouble is the new timer event never fires. The old one is definitely canceled, if I
set it for a short value (like 5 seconds) it doesn't fire after cancellation. But
it's like the new timer is missing something, as it never fires either no matter what
delay value is set.
I've also tried modifying the IntervalTrigger time of the original timer, but this
change doesn't seem to get picked up either.
Both of these I've done while the processInstance.disconnect() was called, and
processInstance.reconnect() is called afterwards.
Thanks for any help/suggestions!
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/634065#634065]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]