예제 #1
0
        /// <summary>
        /// Execute the service.
        /// </summary>
        protected override void Run()
        {
            while (true)
            {
                if ((_threadPool.QueueCount + _threadPool.ActiveCount) < _threadPool.Concurrency)
                {
                    try
                    {
                        ArchiveQueue queueItem = _hsmArchive.GetArchiveCandidate();

                        if (queueItem != null)
                        {
                            HsmStudyArchive archiver = new HsmStudyArchive(_hsmArchive);
                            _threadPool.Enqueue(queueItem, archiver.Run);
                        }
                        else if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                        {
                            Platform.Log(LogLevel.Info, "Shutting down {0} archiving service.", _hsmArchive.PartitionArchive.Description);
                            return;
                        }
                    }
                    catch (Exception e)
                    {
                        Platform.Log(LogLevel.Error, e, "Unexpected exception when querying for archive candidates, rescheduling.");
                        if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                        {
                            Platform.Log(LogLevel.Info, "Shutting down {0} archiving service.", _hsmArchive.PartitionArchive.Description);
                            return;
                        }
                    }
                }
                else
                {
                    if (CheckStop(HsmSettings.Default.PollDelayMilliseconds))
                    {
                        Platform.Log(LogLevel.Info, "Shutting down {0} archiving service.", _hsmArchive.PartitionArchive.Description);
                        return;
                    }
                }
            }
        }
예제 #2
0
		/// <summary>
		/// Execute the service.
		/// </summary>
		protected override void Run()
		{
			while (true)
			{
				if ((_threadPool.QueueCount + _threadPool.ActiveCount) < _threadPool.Concurrency)
				{
					try
					{
						ArchiveQueue queueItem = _hsmArchive.GetArchiveCandidate();

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