/// <summary> /// Kick-off the timer to check for workflows with expired timers, /// and recover running workflow instances. /// </summary> protected override void OnStarted() { TraceHelper.Trace(); try { base.OnStarted(); if (this.loadInterval > TimeSpan.Zero) { lock (this.timerLock) { this.smartTimer = new SmartTimer(new TimerCallback(loadWorkflowsWithExpiredTimers), null, this.loadInterval, this.loadInterval); } } recoverRunningWorkflows(); } catch (Exception e) { TraceHelper.Trace(unexpectedExceptionText, e); base.RaiseServicesExceptionNotHandledEvent(e, Guid.Empty); } }
/// <summary> /// Kick-off the timer to check for workflows with expired timers, /// and recover running workflow instances. /// </summary> protected override void OnStarted() { TraceHelper.Trace(); try { base.OnStarted(); if (_loadInterval > TimeSpan.Zero) { lock (_timerLock) { _smartTimer = new SmartTimer( loadWorkflowsWithExpiredTimers, null, _loadInterval, _loadInterval); } } recoverRunningWorkflows(); } catch (Exception e) { String errorMessage = RM.Get_Error_PersistenceServiceException(e.ToString()); TraceHelper.Trace(errorMessage); PersistenceException persistenceException = new PersistenceException(errorMessage, e); RaiseServicesExceptionNotHandledEvent( persistenceException, Guid.Empty); throw persistenceException; } }
/// <summary> /// Perform shutdown duties associated with this persistence service. /// <remarks> /// This implementation disposes the internal <see cref="SmartTimer" /> /// responsible for loading expired workflows into memory. /// </remarks> /// </summary> protected override void Stop() { TraceHelper.Trace(); try { base.Stop(); lock (_timerLock) { if (_smartTimer != null) { _smartTimer.Dispose(); _smartTimer = null; } } } catch (Exception e) { String errorMessage = RM.Get_Error_PersistenceServiceException(e.ToString()); TraceHelper.Trace(errorMessage); PersistenceException persistenceException = new PersistenceException(errorMessage, e); RaiseServicesExceptionNotHandledEvent( persistenceException, Guid.Empty); throw persistenceException; } }
///<summary> /// Clean-up the timers used by the persistence service. ///</summary> ///<filterpriority>2</filterpriority> protected virtual void Dispose(Boolean disposing) { if (disposing) { lock (_timerLock) { if (_smartTimer != null) { _smartTimer.Dispose(); _smartTimer = null; } } } }
///<summary> /// Clean-up the timers used by the persistence service. ///</summary> ///<filterpriority>2</filterpriority> protected virtual void Dispose(bool disposing) { if (disposing) { lock (this.timerLock) { if (this.smartTimer != null) { this.smartTimer.Dispose(); this.smartTimer = null; } } } }
/// <summary> /// Perform shutdown duties associated with this persistence service. /// <remarks> /// This implementation disposes the internal <see cref="SmartTimer" /> /// responsible for loading expired workflows into memory. /// </remarks> /// </summary> protected override void Stop() { TraceHelper.Trace(); try { base.Stop(); lock (this.timerLock) { if (this.smartTimer != null) { this.smartTimer.Dispose(); this.smartTimer = null; } } } catch (Exception e) { TraceHelper.Trace(unexpectedExceptionText, e); base.RaiseServicesExceptionNotHandledEvent(e, Guid.Empty); } }