当前位置: 首页>>代码示例>>C#>>正文


C# WorkQueueUid.GetKey方法代码示例

本文整理汇总了C#中ClearCanvas.ImageServer.Model.WorkQueueUid.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# WorkQueueUid.GetKey方法的具体用法?C# WorkQueueUid.GetKey怎么用?C# WorkQueueUid.GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClearCanvas.ImageServer.Model.WorkQueueUid的用法示例。


在下文中一共展示了WorkQueueUid.GetKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FailUid

		public static void FailUid(WorkQueueUid sop, bool retry)
		{
			using (IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
			{
				IWorkQueueUidEntityBroker uidUpdateBroker = updateContext.GetBroker<IWorkQueueUidEntityBroker>();
				WorkQueueUidUpdateColumns columns = new WorkQueueUidUpdateColumns();
				if (!retry)
					columns.Failed = true;
				else
				{
					if (sop.FailureCount >= ImageServerCommonConfiguration.WorkQueueMaxFailureCount)
					{
						columns.Failed = true;
					}
					else
					{
						columns.FailureCount = ++sop.FailureCount;
					}
				}

				uidUpdateBroker.Update(sop.GetKey(), columns);
				updateContext.Commit();
			}
		}
开发者ID:yjsyyyjszf,项目名称:ClearCanvas-1,代码行数:24,代码来源:SopInstanceProcessor.cs

示例2: UpdateWorkQueueUid

        /// <summary>
        /// Update an entry in the <see cref="WorkQueueUid"/> table.
        /// </summary>
        /// <remarks>
        /// Note that just the Duplicate, Failed, FailureCount, and Extension columns are updated from the
        /// input parameter <paramref name="sop"/>.
        /// </remarks>
        /// <param name="sop">The <see cref="WorkQueueUid"/> entry to update.</param>
        protected virtual void UpdateWorkQueueUid(WorkQueueUid sop)
        {
            DBUpdateTime.Add(
                TimeSpanStatisticsHelper.Measure(
                delegate
                {
                     using (IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
                     {
                         IWorkQueueUidEntityBroker update = updateContext.GetBroker<IWorkQueueUidEntityBroker>();

                         WorkQueueUidUpdateColumns columns = new WorkQueueUidUpdateColumns
                                                                 {
                                                                     Duplicate = sop.Duplicate,
                                                                     Failed = sop.Failed,
                                                                     FailureCount = sop.FailureCount
                                                                 };

                         if (sop.Extension != null)
                             columns.Extension = sop.Extension;

                         update.Update(sop.GetKey(), columns);

                         updateContext.Commit();
                     }
                }));

            
        }
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:36,代码来源:BaseItemProcessor.cs

示例3: FailWorkQueueUid

        /// <summary>
        /// Routine for failing a work queue uid record.
        /// </summary>
        /// <param name="uid">The WorkQueueUid record to fail.</param>
        /// <param name="retry">A boolean value indicating whether a retry will be attempted later.</param>
        protected void FailWorkQueueUid(WorkQueueUid uid, bool retry)
        {
            using (IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                IWorkQueueUidEntityBroker uidUpdateBroker = updateContext.GetBroker<IWorkQueueUidEntityBroker>();
                WorkQueueUidUpdateColumns columns = new WorkQueueUidUpdateColumns();
                if (!retry)
                    columns.Failed = true;
                else
                {
                    if (uid.FailureCount >= ImageServerCommonConfiguration.WorkQueueMaxFailureCount)
                    {
                        columns.Failed = true;
                    }
                    else
                    {
                        columns.FailureCount = ++uid.FailureCount;
                    }
                }

                if (uidUpdateBroker.Update(uid.GetKey(), columns))
                    updateContext.Commit();
                else
                    throw new ApplicationException(String.Format("FailUid(): Unable to update work queue uid {0}", uid.Key));
            }
            
        }
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:32,代码来源:BaseItemProcessor.cs

示例4: DeleteWorkQueueUid

    	/// <summary>
        /// Delete an entry in the <see cref="WorkQueueUid"/> table.
        /// </summary>
        /// <param name="sop">The <see cref="WorkQueueUid"/> entry to delete.</param>
        protected virtual void DeleteWorkQueueUid(WorkQueueUid sop)
        {
            // Must retry in case of db error.
            // Failure to do so may lead to orphaned WorkQueueUid and FileNotFoundException 
            // when the work queue is reset.
    	    int retryCount = 0;
            while (true)
            {
                try
                {
                    TimeSpanStatistics time = TimeSpanStatisticsHelper.Measure(
                        delegate
                            {
                                using (IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
                                {
                                    IWorkQueueUidEntityBroker delete = updateContext.GetBroker<IWorkQueueUidEntityBroker>();

                                    delete.Delete(sop.GetKey());
                                    updateContext.Commit();
                                }
                        });

                    DBUpdateTime.Add(time);
                    break; // done
        }
                catch (Exception ex)
                {
                    if (ex is PersistenceException || ex is SqlException)
                    {
                        if (retryCount > MAX_DB_RETRY)
                        {
                            Platform.Log(LogLevel.Error, ex, "Error occurred when calling DeleteWorkQueueUid. Max db retry count has been reached.");
                            WorkQueueItem.FailureDescription = String.Format("Error occurred when calling DeleteWorkQueueUid. Max db retry count has been reached.");
                            PostProcessingFailure(WorkQueueItem, WorkQueueProcessorFailureType.Fatal);
                            return;
                        }

                        Platform.Log(LogLevel.Error, ex, "Error occurred when calling DeleteWorkQueueUid(). Retry later. SOPUID={0}", sop.SopInstanceUid);
                        SleepForRetry();


                        // Service is stoping
                        if (CancelPending)
                        {
                            Platform.Log(LogLevel.Warn, "Termination Requested. DeleteWorkQueueUid() is now terminated.");
                            break;
                        }
                        retryCount++;
                    }
                    else
                        throw;
                }
            }

        }
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:59,代码来源:BaseItemProcessor.cs


注:本文中的ClearCanvas.ImageServer.Model.WorkQueueUid.GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。