internal void PauseSessionUntilConflictsResolved(SessionWorker worker) { bool unresolvedConflictsFound = false; while (m_syncStateMachine.CurrentState == PipelineState.PausedByConflict) { if (ConflictManager.DoesSessionHaveUnresolvedConflicts(worker.LeftMigrationSourceid, worker.RightMigrationSourceid)) { if (!unresolvedConflictsFound) { TraceManager.TraceWarning("Session paused due to blocking conflict(s); resolve conflicts for this session to resume"); unresolvedConflictsFound = true; } // sleep at "PausedByConflict" Thread.Sleep(ResumeAfterConflictPollingMilliSecs); } else { if (unresolvedConflictsFound) { TraceManager.TraceInformation("Resuming session {0} that was previously paused by one or more conflicts", m_syncStateMachine.OwnerUniqueId); } break; } } m_syncStateMachine.TryTransit(PipelineSyncCommand.START_NEW_TRIP); }
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); } }