Пример #1
0
		/// <summary>
		/// Run the service.
		/// </summary>
		protected override void Run()
		{

			while (true)
			{
				if ((_threadPool.QueueCount + _threadPool.ActiveCount) < _threadPool.Concurrency)
				{
					try
					{
						RestoreQueue queueItem = _hsmArchive.GetRestoreCandidate();

						if (queueItem != null)
						{
							HsmStudyRestore archiver = new HsmStudyRestore(_hsmArchive);
							_threadPool.Enqueue(queueItem, archiver.Run);
						}
						else if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
						{
							Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
							return;
						}
					}
					catch (Exception e)
					{
						Platform.Log(LogLevel.Error, e, "Unexpected exception when querying for restore candidates.  Rescheduling.");
						if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
						{
							Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
							return;
						}
					}
				}
				else
				{
					if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
					{
						Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
						return;
					}
				}
			}
		}
Пример #2
0
        /// <summary>
        /// Run the service.
        /// </summary>
        protected override void Run()
        {
            while (true)
            {
                if ((_threadPool.QueueCount + _threadPool.ActiveCount) < _threadPool.Concurrency)
                {
                    try
                    {
                        RestoreQueue queueItem = _hsmArchive.GetRestoreCandidate();

                        if (queueItem != null)
                        {
                            HsmStudyRestore archiver = new HsmStudyRestore(_hsmArchive);
                            _threadPool.Enqueue(queueItem, archiver.Run);
                        }
                        else if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                        {
                            Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
                            return;
                        }
                    }
                    catch (Exception e)
                    {
                        Platform.Log(LogLevel.Error, e, "Unexpected exception when querying for restore candidates.  Rescheduling.");
                        if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                        {
                            Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
                            return;
                        }
                    }
                }
                else
                {
                    if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                    {
                        Platform.Log(LogLevel.Info, "Shutting down {0} restore service.", _hsmArchive.PartitionArchive.Description);
                        return;
                    }
                }
            }
        }