static void ThreadManager_ThreadForcedToClose(object sender, Shared.ThreadManagerEventArgs e)
 {
     Shared.EventLog.Add(String.Format("Thread forced to close: {0}, Unresponsive: {1}, Marked For Removal: {2}",
                                       e.Thread.Name, e.Thread.UnResponsive.ToString(), e.Thread.MarkedForRemoval.ToString()));
     Shared.EventLog.Add(String.Format("Start Time: {0}", e.Thread.TimeStart.ToString("g")));
     Shared.EventLog.Add(String.Format("End Time: {0}", e.Thread.TimeFinish.ToString("g")));
 }
        private void _ReplicationThread_ThreadFinishing(object sender, Shared.ThreadManagerEventArgs e)
        {
            if (e.Thread.Name.StartsWith("Replication Thread"))
            {
                Shared.EventLog.Add(String.Format("{0} Finishing; Unresponsive: {1}",
                                                  e.Thread.Name, e.Thread.UnResponsive.ToString()));

                lock (_lockObject)
                {
                    if (_replicationThreads.ContainsKey(e.Thread.Name))
                    {
                        if (e.Thread.UnResponsive)
                        {
                            ThreadManager thread = (ThreadManager)_replicationThreads[e.Thread.Name];
                            _replicationThreads.Remove(e.Thread.Name);
                            thread.CancelThread();
                            Thread.Sleep(2000);
                            CreateReplicationThread();
                        }
                    }
                }
            }
        }