Buggy code:
public class TimerImpl implements Timer { protected final String id ; protected volatile TimerState timerState ; protected final TimerServiceImpl timerService ; protected final TimedObjectInvoker timedObjectInvoker ; protected final Serializable info ; protected final boolean persistent ; protected final TimerHandleImpl handle ; protected final Date initialExpiration ; protected final long intervalDuration ; protected final Object primaryKey ; protected volatile Date nextExpiration ; protected volatile Date previousRun ; protected volatile TimerEntity persistentState ; public TimerImpl ( String id , TimerServiceImpl service , Date initialExpiry , long intervalDuration , Serializable info , boolean persistent , Object primaryKey ) { } public TimerImpl ( String id , TimerServiceImpl service , Date initialExpiry , long intervalDuration , Date nextEpiry , Serializable info , boolean persistent , Object primaryKey ) { } public TimerImpl ( TimerEntity persistedTimer , TimerServiceImpl service ) { } public String getId ( ) { } @ Override public boolean isCalendarTimer ( ) throws IllegalStateException , EJBException { } @ Override public void cancel ( ) throws IllegalStateException , EJBException { } @ Override public TimerHandle getHandle ( ) throws IllegalStateException , EJBException { } public TimerHandle getTimerHandle ( ) { } @ Override public boolean isPersistent ( ) throws IllegalStateException , EJBException { } @ Override public Serializable getInfo ( ) throws IllegalStateException , EJBException { } public Serializable getTimerInfo ( ) { } @ Override public Date getNextTimeout ( ) throws IllegalStateException , EJBException { } public Date getNextExpiration ( ) { } public void setNextTimeout ( Date next ) { } @ Override public ScheduleExpression getSchedule ( ) throws IllegalStateException , EJBException { } @ Override public long getTimeRemaining ( ) throws IllegalStateException , EJBException { } public boolean isAutoTimer ( ) { } protected void cancelTimeout ( ) { } public Date getInitialExpiration ( ) { } public long getInterval ( ) { } public String getTimedObjectId ( ) { } public TimerServiceImpl getTimerService ( ) { } public boolean isActive ( ) { } public boolean isCanceled ( ) { } public boolean isExpired ( ) { } public boolean isInRetry ( ) { } public Date getPreviousRun ( ) { } public void setPreviousRun ( Date previousRun ) { } public TimerState getState ( ) { } protected void assertTimerState ( ) { } public void expireTimer ( ) { EjbLogger . ROOT_LOGGER . debug ( ( "expireTimer:<seq2seq4repair_space>" + ( this ) ) ) ; setTimerState ( EXPIRED ) ; <START_BUG> timerService . removeTimer ( this ) ; <END_BUG> this . cancelTimeout ( ) ; } public void setTimerState ( TimerState state ) { } public TimerEntity getPersistentState ( ) { } public void suspend ( ) { } public void scheduleTimeout ( ) { } protected TimerEntity createPersistentState ( ) { } protected TimerTask < ? > getTimerTask ( ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } private void registerTimerCancellationWithTx ( Transaction tx ) { } private Serializable deserialize ( byte [ ] bytes ) { } private final class ObjectInputStreamWithTCCL extends ObjectInputStream { public ObjectInputStreamWithTCCL ( InputStream in ) throws IOException { } protected Class < ? > resolveClass ( ObjectStreamClass v ) throws IOException , ClassNotFoundException { } } private class TimerCancellationTransactionSynchronization implements Synchronization { private TimerImpl timer ; public TimerCancellationTransactionSynchronization ( TimerImpl timer ) { } @ Override public void afterCompletion ( int status ) { } @ Override public void beforeCompletion ( ) { } } public Object getPrimaryKey ( ) { } }

Fix:
timerService . persistTimer ( this ) ;