예제 #1
0
        internal bool TryStartNextRoundTrip(SessionWorker worker, int sleepSecs)
        {
            // only start another round trip for synchronization sessions
            if (WorkFlowType.Frequency != Frequency.ContinuousAutomatic)
            {
                return(false);
            }

            try
            {
                // in case the session is requested to PAUSE
                Check();

                Thread.Sleep(sleepSecs);
                m_syncStateMachine.TryTransit(PipelineSyncCommand.START_NEW_TRIP);

                return(true);
            }
            catch (PauseConflictedSessionException)
            {
                PauseSessionUntilConflictsResolved(worker);
                return(true);
            }
            catch (StopSessionException)
            {
                return(false);
            }
            catch (StopSingleTripException)
            {
                Thread.Sleep(sleepSecs);
                m_syncStateMachine.TryTransit(PipelineSyncCommand.START_NEW_TRIP);
                return(true);
            }
        }
예제 #2
0
        private void MarkSessionRunning()
        {
            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                var sessionQuery = context.RTSessionSet.Where
                    (s => s.SessionUniqueId.Equals(SessionId));
                Debug.Assert(sessionQuery.Count() == 1);

                // we want to keep StartedInStandaloneProcess session status untouched
                if (sessionQuery.First().State != (int)BusinessModelManager.SessionStateEnum.StartedInStandaloneProcess)
                {
                    sessionQuery.First().State = (int)BusinessModelManager.SessionStateEnum.Running;
                }
                context.TrySaveChanges();
            }

            // If the OrchestrationStatus for the session is PausedByConflict, it should stay in that state
            // until all conflict for the session are resolved
            if (m_syncStateMachine.CurrentState != PipelineState.PausedByConflict)
            {
                if (m_syncStateMachine.TryTransit(PipelineSyncCommand.START))
                {
                    m_syncStateMachine.CommandTransitFinished(PipelineSyncCommand.START);
                }
                else
                {
                    throw new MigrationException();
                }
            }
        }
예제 #3
0
        private void MarkSessionRunning()
        {
            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                var sessionQuery = context.RTSessionSet.Where
                                       (s => s.SessionUniqueId.Equals(SessionId));
                Debug.Assert(sessionQuery.Count() == 1);

                // we want to keep StartedInStandaloneProcess session status untouched
                if (sessionQuery.First().State != (int)BusinessModelManager.SessionStateEnum.StartedInStandaloneProcess)
                {
                    sessionQuery.First().State = (int)BusinessModelManager.SessionStateEnum.Running;
                }
                context.TrySaveChanges();
            }

            if (m_syncStateMachine.TryTransit(PipelineSyncCommand.START))
            {
                m_syncStateMachine.CommandTransitFinished(PipelineSyncCommand.START);
            }
            else
            {
                throw new MigrationException();
            }
        }