ejb3/src/main/java/org/jboss/as/ejb3/timerservice/TimerServiceImpl.java
public void persistTimer(final TimerImpl timer, boolean newTimer) {
        if (timer == null) {
            return;
        }
        if (timer.isTimerPersistent()) {
            try {
                if (timerPersistence.getOptionalValue() == null) {
                    EJB3_TIMER_LOGGER.timerPersistenceNotEnable();
                    return;
                }
                final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
                Transaction clientTX = transactionManager.getTransaction();
                if (newTimer || timer.isCanceled()) {
                    if( clientTX == null ){
                        transactionManager.begin();
                    }
                    try {
                        if( newTimer ) timerPersistence.getValue().addTimer(timer);
                        else timerPersistence.getValue().persistTimer(timer);
                        if(clientTX == null) transactionManager.commit();
                    } catch (Exception e){
                        if(clientTX == null) {
                            try {
                                transactionManager.rollback();
                            } catch (Exception ee){
                                EjbLogger.EJB3_TIMER_LOGGER.timerUpdateFailedAndRollbackNotPossible(ee);
                            }
                        }
                        throw e;
                    }
                } else {
                    new TaskPostPersist(timer).persistTimer();
                }

            } catch (Throwable t) {
                this.setRollbackOnly();
                throw new RuntimeException(t);
            }
        }
    }
public void persistTimer(final TimerImpl timer, boolean newTimer) {
        if (timer == null) {
            return;
        }
        if (timer.isTimerPersistent()) {
            try {
                if (timerPersistence.getOptionalValue() == null) {
                    EJB3_TIMER_LOGGER.timerPersistenceNotEnable();
                    return;
                }
                final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
                Transaction clientTX = transactionManager.getTransaction();
                if (newTimer || timer.isCanceled()) {
                    if( clientTX == null ){
                        transactionManager.begin();
                    }
                    try {
                        if( newTimer ) timerPersistence.getValue().addTimer(timer);
                        else timerPersistence.getValue().persistTimer(timer);
                        if(clientTX == null) transactionManager.commit();
                    } catch (Exception e){
                        if(clientTX == null) {
                            try {
                                transactionManager.rollback();
                            } catch (Exception ee){
                                EjbLogger.EJB3_TIMER_LOGGER.timerUpdateFailedAndRollbackNotPossible(ee);
                            }
                        }
                        throw e;
                    }
                } else {
                    new TaskPostPersist(timer).persistTimer();
                }

            } catch (Throwable t) {
                this.setRollbackOnly();
                throw new RuntimeException(t);
            }
        }
    }
public void persistTimer ( final TimerImpl timer , boolean newTimer ) { if ( timer == null ) { return ; } if ( timer . isTimerPersistent ( ) ) { try { if ( timerPersistence . getOptionalValue ( ) == null ) { EJB3_TIMER_LOGGER . timerPersistenceNotEnable ( ) ; return ; } final ContextTransactionManager transactionManager = ContextTransactionManager . getInstance ( ) ; Transaction clientTX = transactionManager . getTransaction ( ) ; if ( newTimer || timer . isCanceled ( ) ) { if ( clientTX == null ) { transactionManager . begin ( ) ; } try { if ( newTimer ) timerPersistence . getValue ( ) . addTimer ( timer ) ; else timerPersistence . getValue ( ) . persistTimer ( timer ) ; if ( clientTX == null ) transactionManager . commit ( ) ; } catch ( Exception e ) { if ( clientTX == null ) { try { transactionManager . rollback ( ) ; } catch ( Exception ee ) { EjbLogger . EJB3_TIMER_LOGGER . timerUpdateFailedAndRollbackNotPossible ( ee ) ; } } throw e ; } } else { new TaskPostPersist ( timer ) . persistTimer ( ) ; } } catch ( Throwable t ) { this . setRollbackOnly ( ) ; throw new RuntimeException ( t ) ; } } }
Persists the passed <code>timer</code>.
<p/>
<p>
If the passed timer is null or is non-persistent (i.e. {@link javax.ejb.Timer#isPersistent()} returns false),
then this method acts as a no-op
</p>

@param timer
Persists the passed <code > timer< / code > . <p / > <p > If the passed timer is null or is non - persistent ( i . e . { @link javax . ejb . Timer#isPersistent () } returns false ) then this method acts as a no - op < / p >