The timer works well when a few process instances are created. However, when I load the system by creating scores of process instances, I observe that for a few process instances, timer records are not cleared from the JBPM_TIMER table even after those process instances transition out of "state_one". The scheduler keeps updating the due dates for such timer records and the action class is periodically invoked. This behavior continues as long as such process instances do not reach the end state.
How can I ensure that the timer associated with a state gets cancelled when the process instance moves out of that state? Alternately, how do I programmatically cancel a timer from the execute method of the action class after confirming that the process instance is no longer in the timed state