protected void startTimer(TimerImpl timer) {
        // if there's no transaction, then trigger a schedule immediately.
        // Else, the timer will be scheduled on tx synchronization callback
        if (!transactionActive()) {
            this.timers.put(timer.getId(), timer);
            // set active if the timer is started if it was read
            // from persistence as current running to ensure correct schedule here
            timer.setTimerState(TimerState.ACTIVE, null);
            // create and schedule a timer task
            this.registerTimerResource(timer.getId());
            timer.scheduleTimeout(true);
        } else {
            addWaitingOnTxCompletionTimer(timer);
            registerSynchronization(new TimerCreationTransactionSynchronization(timer));
        }
    }
protected void startTimer(TimerImpl timer) {
        
        
        if (!transactionActive()) {
            this.timers.put(timer.getId(), timer);
            
            
            timer.setTimerState(TimerState.ACTIVE, null);
            
            this.registerTimerResource(timer.getId());
            timer.scheduleTimeout(true);
        } else {
            addWaitingOnTxCompletionTimer(timer);
            registerSynchronization(new TimerCreationTransactionSynchronization(timer));
        }
    }
protected void startTimer ( TimerImpl timer ) { // if there's no transaction, then trigger a schedule immediately. // Else, the timer will be scheduled on tx synchronization callback if ( ! transactionActive ( ) ) { this . timers . put ( timer . getId ( ) , timer ) ; // set active if the timer is started if it was read // from persistence as current running to ensure correct schedule here timer . setTimerState ( TimerState . ACTIVE , null ) ; // create and schedule a timer task this . registerTimerResource ( timer . getId ( ) ) ; timer . scheduleTimeout ( true ) ; } else { addWaitingOnTxCompletionTimer ( timer ) ; registerSynchronization ( new TimerCreationTransactionSynchronization ( timer ) ) ; } }
Registers a timer with a transaction (if any in progress) and then moves
the timer to an active state, so that it becomes eligible for timeouts
Registers a timer with a transaction ( if any in progress ) and then moves the timer to an active state so that it becomes eligible for timeouts