if ( timer == null ) {
// no timer exists, so ok on it's own
timer = durationTimer;
} else {
// timer exists so we need to make a composite
CompositeMaxDurationTimer temp = new CompositeMaxDurationTimer();
if ( timer instanceof DurationTimer ) {
// previous timer was a duration, so add another DurationTimer
temp.addDurationTimer( ( DurationTimer ) timer );
} else {
// previous timer was not a duration, so set it as the delegate Timer.
temp.setTimer( context.getRule().getTimer() );
}
// now add the new durationTimer
temp.addDurationTimer( durationTimer );
timer = temp;
}
// with the composite made, reset it on the Rule
context.getRule().setTimer( timer );
}