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


C# JobKey.ToBsonDocument方法代码示例

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


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

示例1: RemoveJob

        /// <summary>
        /// Remove (delete) the <see cref="IJob" /> with the given
        /// name, and any <see cref="ITrigger" /> s that reference
        /// it.
        /// </summary>
        /// <returns>
        /// 	<see langword="true" /> if a <see cref="IJob" /> with the given name and
        /// group was found and removed from the store.
        /// </returns>
        public virtual bool RemoveJob(JobKey jobKey)
        {
            bool found;

            lock (lockObject)
            {
                // keep separated to clean up any staled trigger
                IList<IOperableTrigger> triggersForJob = this.GetTriggersForJob(jobKey);
                foreach (IOperableTrigger trigger in triggersForJob)
                {
                    this.RemoveTrigger(trigger.Key);
                }

                found = this.CheckExists(jobKey);

                if (found)
                {
                    this.Jobs.Remove(
                    Query.EQ("_id", jobKey.ToBsonDocument()));

                    this.BlockedJobs.Remove(
                        Query.EQ("_id", jobKey.ToBsonDocument()));

                    var others = this.Jobs.FindAs<BsonDocument>(
                        Query.EQ("Group", jobKey.Group));

                    if (others.Count() == 0)
                    {
                        this.PausedJobGroups.Remove(
                            Query.EQ("_id", jobKey.Group));
                    }
                }
            }

            return found;
        }
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:45,代码来源:JobStore.cs

示例2: CheckExists

 /// <summary>
 /// Determine whether a <see cref="IJob"/> with the given identifier already 
 /// exists within the scheduler.
 /// </summary>
 /// <param name="jobKey">the identifier to check for</param>
 /// <returns>true if a Job exists with the given identifier</returns>
 public bool CheckExists(JobKey jobKey)
 {
     lock (lockObject)
     {
         return this.Jobs.FindOneByIdAs<BsonDocument>(jobKey.ToBsonDocument()) != null;
     }
 }
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:13,代码来源:JobStore.cs

示例3: GetTriggersForJob

 /// <summary>
 /// Get all of the Triggers that are associated to the given Job.
 /// <para>
 /// If there are no matches, a zero-length array should be returned.
 /// </para>
 /// </summary>
 public virtual IList<IOperableTrigger> GetTriggersForJob(JobKey jobKey)
 {
     lock (lockObject)
     {
         return this.Triggers
             .FindAs<Spi.IOperableTrigger>(
                 Query.EQ("JobKey", jobKey.ToBsonDocument()))
             .ToList();
     }
 }
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:16,代码来源:JobStore.cs

示例4: RetrieveJob

 /// <summary>
 /// Retrieve the <see cref="IJobDetail" /> for the given
 /// <see cref="IJob" />.
 /// </summary>
 /// <returns>
 /// The desired <see cref="IJob" />, or null if there is no match.
 /// </returns>
 public virtual IJobDetail RetrieveJob(JobKey jobKey)
 {
     lock (lockObject)
     {
         return this.Jobs
             .FindOneByIdAs<IJobDetail>(jobKey.ToBsonDocument());
     }
 }
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:15,代码来源:JobStore.cs

示例5: RetrieveJob

 /// <summary>
 /// Retrieve the <see cref="IJobDetail" /> for the given
 /// <see cref="IJob" />.
 /// </summary>
 /// <returns>
 /// The desired <see cref="IJob" />, or null if there is no match.
 /// </returns>
 public IJobDetail RetrieveJob(JobKey jobKey)
 {
     try
     {
         var jobInfo = JobCollection.FindOneById(jobKey.ToBsonDocument());
         return jobInfo.Job;
     }
     catch (Exception e)
     {
         throw new JobPersistenceException("Couldn't retrieve job: " + e.Message, e);
     }
 }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:19,代码来源:MongoJobStore.cs

示例6: GetTriggersForJob

 /// <summary>
 /// Get all of the Triggers that are associated to the given Job.
 /// </summary>
 /// <remarks>
 /// If there are no matches, a zero-length array should be returned.
 /// </remarks>
 public IList<IOperableTrigger> GetTriggersForJob(JobKey jobKey)
 {
     var id = jobKey.ToBsonDocument();
     var jobInfo = JobCollection.FindOneById(id);
     foreach (var triggerInfo in jobInfo.Triggers)
     {
         triggerInfo.Trigger.Key = triggerInfo.Id;
         triggerInfo.Trigger.JobKey = jobKey;
     }
     var triggers = jobInfo.Triggers.Select(x => x.Trigger);
     return triggers.ToList();
 }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:18,代码来源:MongoJobStore.cs

示例7: CheckExists

 /// <summary>
 /// Determine whether a <see cref="IJob" /> with the given identifier already
 /// exists within the scheduler.
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="jobKey">the identifier to check for</param>
 /// <returns>true if a job exists with the given identifier</returns>
 public bool CheckExists(JobKey jobKey)
 {
     var id = jobKey.ToBsonDocument();
     var count = JobCollection.Count(Query.EQ("_id", id));
     return (count > 0);
 }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:14,代码来源:MongoJobStore.cs

示例8: DeleteJob

 private void DeleteJob(JobKey key)
 {
     var query = Query.EQ("_id", key.ToBsonDocument());
     JobCollection.Remove(query);
 }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:5,代码来源:MongoJobStore.cs


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