Esempio n. 1
0
 /// <summary>
 /// Gets a singleton instance of this class.
 /// </summary>
 /// <returns></returns>
 public static SqlSyncStateManager GetInstance()
 {
     if (m_instance == null)
     {
         m_instance = new SqlSyncStateManager();
     }
     return(m_instance);
 }
Esempio n. 2
0
        internal SessionWorker(
            Guid sessionId,
            ManualResetEvent sessionEvent,
            AnalysisEngine analysisEngine,
            MigrationEngine migrationEngine,
            LinkEngine linkEngine,
            Guid leftMigrationSourceId,
            Guid rightMigrationSourceId,
            WorkFlowType workFlowType,
            int secondsSyncWaitInterval,
            string threadName)
        {
            SessionId              = sessionId;
            Event                  = sessionEvent;
            AnalysisEngine         = analysisEngine;
            MigrationEngine        = migrationEngine;
            LinkEngine             = linkEngine;
            LeftMigrationSourceid  = leftMigrationSourceId;
            RightMigrationSourceid = rightMigrationSourceId;
            WorkFlowType           = workFlowType;
            m_threadName           = threadName;

            SqlSyncStateManager manager = SqlSyncStateManager.GetInstance();

            m_syncStateManager = manager;
            m_syncCommandQueue = manager;

            m_syncStateMachine = new SyncStateMachine(PipelineState.Default, new SyncStateTransitionAlgorithm(),
                                                      OwnerType.Session, sessionId, m_syncStateManager);
            m_orchPolicy = new SessionOrchestrationPolicy(WorkFlowType, m_syncStateMachine);

            try
            {
                checked
                {
                    MilliSecondsSyncWaitInterval = secondsSyncWaitInterval * 1000;
                }
            }
            catch (OverflowException)
            {
                MilliSecondsSyncWaitInterval = int.MaxValue;
                TraceManager.TraceInformation(
                    "The speicified interval of {0} minutes is too long for the system to handle. The interval is now changed to {1} minutes.",
                    secondsSyncWaitInterval / 60,
                    (int)(MilliSecondsSyncWaitInterval / 1000 / 60));
            }
        }