Buggy code:
public class TimerTask < T extends TimerImpl > implements Runnable { protected final String timedObjectId ; protected final String timerId ; protected final TimerServiceImpl timerService ; private volatile boolean cancelled = false ; public TimerTask ( T timer ) { } @ Override public void run ( ) { final TimerImpl timer = timerService . getTimer ( timerId ) ; try { if ( cancelled ) { <START_BUG> ROOT_LOGGER . debugf ( "Timer<seq2seq4repair_space>task<seq2seq4repair_space>was<seq2seq4repair_space>cancelled<seq2seq4repair_space>for<seq2seq4repair_space>%s" , timer ) ; <END_BUG> return ; } Date now = new Date ( ) ; if ( ROOT_LOGGER . isDebugEnabled ( ) ) { ROOT_LOGGER . debug ( ( ( ( "Timer<seq2seq4repair_space>task<seq2seq4repair_space>invoked<seq2seq4repair_space>at:<seq2seq4repair_space>" + now ) + "<seq2seq4repair_space>for<seq2seq4repair_space>timer<seq2seq4repair_space>" ) + timer ) ) ; } if ( timer . isInRetry ( ) ) { ROOT_LOGGER . skipInvokeTimeoutDuringRetry ( timer , now ) ; timer . setNextTimeout ( calculateNextTimeout ( timer ) ) ; timerService . persistTimer ( timer , false ) ; scheduleTimeoutIfRequired ( timer ) ; return ; } if ( ( ( timer . getState ( ) ) == ( TimerState . IN_TIMEOUT ) ) || ( ( timer . getState ( ) ) == ( TimerState . RETRY_TIMEOUT ) ) ) { ROOT_LOGGER . skipOverlappingInvokeTimeout ( timer , now ) ; timer . setNextTimeout ( this . calculateNextTimeout ( timer ) ) ; timerService . persistTimer ( timer , false ) ; scheduleTimeoutIfRequired ( timer ) ; return ; } if ( ! ( timerService . shouldRun ( timer ) ) ) { ROOT_LOGGER . debugf ( "Skipping<seq2seq4repair_space>execution<seq2seq4repair_space>of<seq2seq4repair_space>timer<seq2seq4repair_space>for<seq2seq4repair_space>%s<seq2seq4repair_space>as<seq2seq4repair_space>it<seq2seq4repair_space>is<seq2seq4repair_space>being<seq2seq4repair_space>run<seq2seq4repair_space>on<seq2seq4repair_space>another<seq2seq4repair_space>node<seq2seq4repair_space>or<seq2seq4repair_space>the<seq2seq4repair_space>execution<seq2seq4repair_space>is<seq2seq4repair_space>suppressed<seq2seq4repair_space>by<seq2seq4repair_space>configuration" , timer . getTimedObjectId ( ) ) ; timer . setNextTimeout ( calculateNextTimeout ( timer ) ) ; scheduleTimeoutIfRequired ( timer ) ; return ; } timer . lock ( ) ; try { if ( ! ( timer . isActive ( ) ) ) { ROOT_LOGGER . debug ( ( ( ( "Timer<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>active,<seq2seq4repair_space>skipping<seq2seq4repair_space>this<seq2seq4repair_space>scheduled<seq2seq4repair_space>execution<seq2seq4repair_space>at:<seq2seq4repair_space>" + now ) + "for<seq2seq4repair_space>" ) + timer ) ) ; return ; } timer . setPreviousRun ( new Date ( ) ) ; Date nextTimeout = this . calculateNextTimeout ( timer ) ; timer . setNextTimeout ( nextTimeout ) ; timer . setTimerState ( IN_TIMEOUT ) ; timerService . persistTimer ( timer , false ) ; } finally { timer . unlock ( ) ; } try { this . callTimeout ( timer ) ; } catch ( BeanRemovedException e ) { ROOT_LOGGER . debugf ( "Removing<seq2seq4repair_space>timer<seq2seq4repair_space>%s<seq2seq4repair_space>as<seq2seq4repair_space>EJB<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>removed<seq2seq4repair_space>" , timer ) ; timer . cancel ( ) ; } catch ( Exception e ) { ROOT_LOGGER . errorInvokeTimeout ( timer , e ) ; try { ROOT_LOGGER . timerRetried ( timer ) ; retryTimeout ( timer ) ; } catch ( Exception retryException ) { ROOT_LOGGER . errorDuringRetryTimeout ( timer , retryException ) ; } } finally { this . postTimeoutProcessing ( timer ) ; timerService . persistTimer ( timer , false ) ; } } catch ( Exception e ) { ROOT_LOGGER . exceptionRunningTimerTask ( timer , timedObjectId , e ) ; } } protected void scheduleTimeoutIfRequired ( TimerImpl timer ) { } protected void callTimeout ( TimerImpl timer ) throws Exception { } protected Date calculateNextTimeout ( TimerImpl timer ) { } protected void retryTimeout ( TimerImpl timer ) throws Exception { } protected void postTimeoutProcessing ( TimerImpl timer ) { } public void cancel ( ) { } }

Fix:
ROOT_LOGGER . debug ( ( "Timer<seq2seq4repair_space>task<seq2seq4repair_space>was<seq2seq4repair_space>cancelled<seq2seq4repair_space>for<seq2seq4repair_space>" + timer ) ) ;