• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# JobKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: JobInfo

 public JobInfo(JobKey id, JobDetailImpl job)
 {
     Id = id;
     Job = job;
     Triggers = new TriggerInfo[0];
     TriggerCount = 0;
 }
开发者ID:CaptainCodeman,项目名称:quartznet,代码行数:7,代码来源:JobInfo.cs


示例2: ShouldDisposeScopeAfterJobCompletion

        public void ShouldDisposeScopeAfterJobCompletion()
        {
            var key = new JobKey("disposable", "grp2");
            var job1 = JobBuilder.Create<SampleJob>().WithIdentity(key).StoreDurably(true)
                .Build();
            var trigger =
                TriggerBuilder.Create().WithSimpleSchedule(s => s.WithIntervalInSeconds(1).WithRepeatCount(1)).Build();

            var scopesCreated = 0;
            var scopesDisposed = 0;
            DisposableDependency dependency = null;

            _lifetimeScope.ChildLifetimeScopeBeginning += (sender, args) =>
            {
                scopesCreated++;
                dependency = args.LifetimeScope.Resolve<DisposableDependency>();
                args.LifetimeScope.CurrentScopeEnding += (o, eventArgs) => { scopesDisposed++; };
            };

            _scheduler.ScheduleJob(job1, trigger);
            _scheduler.Start();

            Thread.Sleep(3.Seconds());

            _jobFactory.RunningJobs.Should().BeEmpty("Scope was not disposed after job completion");
            dependency.Disposed.Should().BeTrue("Dependency must be disposed");
            scopesDisposed.Should().Be(scopesCreated, "All scopes must be disposed");
        }
开发者ID:Boichu87,项目名称:Autofac.Extras.Quartz,代码行数:28,代码来源:ScopeTrackerTests.cs


示例3: Deserialize

        public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)
        {
            if (nominalType != typeof(JobKey) || actualType != typeof(JobKey))
            {
                var message = string.Format("Can't deserialize a {0} from {1}.", nominalType.FullName, this.GetType().Name);
                throw new BsonSerializationException(message);
            }

            var bsonType = bsonReader.CurrentBsonType;
            if (bsonType == BsonType.Document)
            {
                JobKey item;
                
                bsonReader.ReadStartDocument();
                item = new JobKey(
                    bsonReader.ReadString("Name"),
                    bsonReader.ReadString("Group"));
                bsonReader.ReadEndDocument();

                return item;
            }
            else if (bsonType == BsonType.Null)
            {
                bsonReader.ReadNull();
                return null;
            }
            else
            {
                var message = string.Format("Can't deserialize a {0} from BsonType {1}.", nominalType.FullName, bsonType);
                throw new BsonSerializationException(message);
            }
        }
开发者ID:Jiangew,项目名称:quartz.net-mongodb,代码行数:32,代码来源:JobKeySerializer.cs


示例4: GetSchedule

            public JobSchedule GetSchedule()
            {
                var jobKey = new JobKey(JobName, JobGroup);

                var trigger = Instance.GetTriggersOfJob(jobKey).FirstOrDefault();

                var js = new JobSchedule();

                if (trigger != null)
                {
                    js.Name = trigger.Key.Name;
                    js.Group = trigger.Key.Group;
                    js.Description = trigger.Description;
                    js.Priority = trigger.Priority;
                    js.TriggerType = trigger.GetType().Name;
                    js.TriggerState = Instance.GetTriggerState(trigger.Key).ToString();

                    DateTimeOffset? startTime = trigger.StartTimeUtc;
                    js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);

                    var nextFireTime = trigger.GetNextFireTimeUtc();
                    if (nextFireTime.HasValue)
                    {
                        js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
                    }

                    var previousFireTime = trigger.GetPreviousFireTimeUtc();
                    if (previousFireTime.HasValue)
                    {
                        js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
                    }
                }

                return js;
            }
开发者ID:feik,项目名称:crystal-quartz,代码行数:35,代码来源:Scheduler.cs


示例5: ExceptionPolicyNoRestartImmediately

        public void ExceptionPolicyNoRestartImmediately()
        {
            sched.Start();
            JobKey jobKey = new JobKey("ExceptionPolicyNoRestartJob", "ExceptionPolicyNoRestartGroup");
            JobDetailImpl exceptionJob = new JobDetailImpl(jobKey.Name, jobKey.Group, typeof (ExceptionJob));
            exceptionJob.Durable = true;
            sched.AddJob(exceptionJob, false);

            ExceptionJob.ThrowsException = true;
            ExceptionJob.Refire = false;
            ExceptionJob.UnscheduleAllTriggers = false;
            ExceptionJob.UnscheduleFiringTrigger = false;
            ExceptionJob.LaunchCount = 0;
            sched.TriggerJob(jobKey);

            int i = 10;
            while ((i > 0) && (ExceptionJob.LaunchCount <= 1))
            {
                i--;
                Thread.Sleep(200);
                if (ExceptionJob.LaunchCount > 1)
                {
                    break;
                }
            }
            sched.DeleteJob(jobKey);
            Assert.AreEqual(1, ExceptionJob.LaunchCount, "The job should NOT have been refired after exception");
        }
开发者ID:vaskosound,项目名称:FantasyLeagueStats,代码行数:28,代码来源:ExceptionJobTest.cs


示例6: ScheduleJob

 public static void ScheduleJob(this IScheduler scheduler, JobKey jobKey, string scheduleText, TimeZoneInfo timeZone)
 {
     TextToScheduleFactory factory = new TextToScheduleFactory();
     var english = factory.CreateEnglishParser();
     var results = english.Parse(scheduleText, timeZone);
     results.ScheduleWithJobKey(scheduler, jobKey);
 }
开发者ID:amazing-andrew,项目名称:Quartz.TextToSchedule,代码行数:7,代码来源:TextToScheduleExtensions.cs


示例7: AddRepeatingJob

        public void AddRepeatingJob(Type aType, string aName, string aGroup, int aSecondsToSleep, params JobItem[] aItems)
        {
            JobKey key = new JobKey(aName, aGroup);
            if (Scheduler.GetJobDetail(key) != null)
            {
                Log.Error("AddRepeatingJob(" + aType.Name + ", " + aName + ", " + aGroup + ") already exists");
                return;
            }
            Log.Info("AddRepeatingJob(" + aType.Name + ", " + aName + ", " + aGroup + ", " + aSecondsToSleep + ")");

            _scheduledJobs.Add(key);

            var data = new JobDataMap();
            foreach (JobItem item in aItems)
            {
                data.Add(item.Key, item.Value);
            }

            IJobDetail job = JobBuilder.Create(aType)
                .WithIdentity(key)
                .UsingJobData(data)
                .Build();

            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity(aName, aGroup)
                .WithSimpleSchedule(x => x.WithIntervalInSeconds(aSecondsToSleep).RepeatForever())
                .Build();

            Scheduler.ScheduleJob(job, trigger);
        }
开发者ID:scottc,项目名称:xdcc-grabscher,代码行数:30,代码来源:AWorker.cs


示例8: GetJobDetailsData

        public JobDetailsData GetJobDetailsData(JobKey jobKey)
        {
            var scheduler = _schedulerProvider.Scheduler;

            if (scheduler.IsShutdown)
            {
                return null;
            }

            var job = scheduler.GetJobDetail(jobKey);
            if (job == null)
            {
                return null;
            }

            var detailsData = new JobDetailsData
            {
                PrimaryData = GetJobData(scheduler, jobKey)
            };

            foreach (var key in job.JobDataMap.Keys)
            {
                detailsData.JobDataMap.Add(key, job.JobDataMap[key]);
            }

            detailsData.JobProperties.Add("Description", job.Description);
            detailsData.JobProperties.Add("Full name", job.Key.Name);
            detailsData.JobProperties.Add("Job type", job.JobType);
            detailsData.JobProperties.Add("Durable", job.Durable);
            //detailsData.JobProperties.Add("Volatile", job.);

            return detailsData;
        }
开发者ID:jiangzhuo,项目名称:CrystalQuartz,代码行数:33,代码来源:DefaultSchedulerDataProvider.cs


示例9: RemoveSchedule

 public void RemoveSchedule(Schedule schedule)
 {
     var triggerKey = new TriggerKey(schedule.Id.ToString(), schedule.CommandId.ToString());
     var jobKey = new JobKey(schedule.Id.ToString(), schedule.CommandId.ToString());
     scheduler.UnscheduleJob(triggerKey);
     scheduler.DeleteJob(jobKey);
 }
开发者ID:vgreggio,项目名称:CrossoverTest,代码行数:7,代码来源:SchedulerEngine.cs


示例10: JobDeleted

 public void JobDeleted(JobKey jobKey)
 {
     foreach (ISchedulerListener listener in listeners)
     {
         listener.JobDeleted(jobKey);
     }
 }
开发者ID:jondhinkle,项目名称:Rock,代码行数:7,代码来源:BroadcastSchedulerListener.cs


示例11: PostTriggerJob

        public HttpResponseMessage PostTriggerJob(string id)
        {
            JobKey jobKey = new JobKey(id);

            _scheduler.TriggerJob(jobKey);

            return new HttpResponseMessage();
        }
开发者ID:gmareater,项目名称:QuartzNetAPI,代码行数:8,代码来源:JobsController.cs


示例12: IsBelongsToGroup

        private bool IsBelongsToGroup(JobKey jobKey)
        {
            var jobDetail = _scheduler.GetJobDetail(jobKey);
            if (jobDetail.JobDataMap == null || !jobDetail.JobDataMap.Contains("data"))
                return false;

            var data = JsonConvert.DeserializeObject<SendCreativePackagesWithIntervalTask.Data>((string) jobDetail.JobDataMap["data"]);
            return data.Group == Group;
        }
开发者ID:mamluka,项目名称:SpeedyMailer,代码行数:9,代码来源:PauseSpecificSendingJobsCommand.cs


示例13: GetTriggers

 private static IEnumerable<TriggerWithState> GetTriggers(ISchedulerWrapper scheduler, JobKey jobKey) {
     var triggers = scheduler.GetTriggersOfJob(jobKey);
     if (triggers == null)
         return null;
     return triggers.Select(t => {
         var state = scheduler.GetTriggerState(t.Key);
         return new TriggerWithState(t, state);
     });
 }
开发者ID:weizhong1988,项目名称:QuartzNetWebConsole,代码行数:9,代码来源:TriggersByJobController.cs


示例14: JobModel

        public JobModel(IScheduler scheduler, JobKey jobKey)
        {
            foreach (ITrigger trigger in scheduler.GetTriggersOfJob(jobKey))
            {
                _triggersForJob.Add(new TriggerModel(trigger));
            }

            MapValuesFromJobDetail(scheduler.GetJobDetail(jobKey));
        }
开发者ID:GrLawrence,项目名称:QuartzPocketWatch,代码行数:9,代码来源:JobModel.cs


示例15: DeleteJob

 /// <summary>
 /// 删除现有任务
 /// </summary>
 /// <param name="JobKey"></param>
 public static void DeleteJob(string JobKey)
 {
     JobKey jk = new JobKey(JobKey);
     if (scheduler.CheckExists(jk))
     {
         //任务已经存在则删除
         scheduler.DeleteJob(jk);
         LogHelper.WriteLog(string.Format("任务“{0}”已经删除", JobKey));
     }
 }
开发者ID:CrazyJson,项目名称:TaskManager,代码行数:14,代码来源:QuartzHelper.cs


示例16: CreateTrigger

        private static ICronTrigger CreateTrigger(DepotSchedule depotSchedule, Depot depot, JobKey jobKey)
        {
            var expression = CronExpressionConverter.ConvertToCronExpression(depotSchedule.DaysOfTheWeek, depotSchedule.Hour, depotSchedule.Minutes);
            //This is for debugging purposes
            //var result = CronExpression.IsValidExpression(expression);

            var timezone = TimeZoneInfo.GetSystemTimeZones().Single(tz => tz.Id == depot.TimeZoneId);

            var cronScheduleBuilder = CronScheduleBuilder.CronSchedule(expression).InTimeZone(timezone).WithMisfireHandlingInstructionFireAndProceed();
            return (ICronTrigger) TriggerBuilder.Create().ForJob(jobKey).WithSchedule(cronScheduleBuilder).Build();
        }
开发者ID:sanilpaul,项目名称:Quartz-NServicebus,代码行数:11,代码来源:JobSetUp.cs


示例17: Execute

 public static Response Execute(RelativeUri url, Func<ISchedulerWrapper> getScheduler) {
     var scheduler = getScheduler();
     var querystring = url.ParseQueryString();
     var highlight = querystring["highlight"];
     var group = querystring["group"];
     var job = querystring["job"];
     var jobKey = new JobKey(job, group);
     var triggers = GetTriggers(scheduler, jobKey);
     var m = new TriggersByJobModel(triggers, url.PathAndQuery, group, job, highlight);
     return new Response.XDocumentResponse(Helpers.XHTML(Views.Views.TriggersByJob(m)));
 }
开发者ID:weizhong1988,项目名称:QuartzNetWebConsole,代码行数:11,代码来源:TriggersByJobController.cs


示例18: ScheduleWithJobKey

        /// <summary>
        /// Schedules the Triggers with a given job key.
        /// </summary>
        /// <param name="sched">The sched.</param>
        /// <param name="jobKey">The job key.</param>
        public void ScheduleWithJobKey(IScheduler sched, JobKey jobKey)
        {
            RegisterCalendars(sched);

            foreach (var group in RegisterGroups)
            {
                group.TriggerBuilder.ForJob(jobKey);

                ITrigger trigger = group.TriggerBuilder.Build();
                sched.ScheduleJob(trigger);
            }
        }
开发者ID:amazing-andrew,项目名称:Quartz.TextToSchedule,代码行数:17,代码来源:TextToScheduleResults.cs


示例19: Execute

 public static void Execute(HttpContextBase context, Func<ISchedulerWrapper> getScheduler)
 {
     var scheduler = getScheduler();
     var highlight = context.Request.QueryString["highlight"];
     var group = context.Request.QueryString["group"];
     var job = context.Request.QueryString["job"];
     var jobKey = new JobKey(job, group);
     var triggers = GetTriggers(scheduler, jobKey);
     var thisUrl = context.Request.RawUrl;
     var m = new TriggersByJobModel(triggers, thisUrl, group, job, highlight);
     context.Response.Html(Helpers.XHTML(Views.Views.TriggersByJob(m)));
 }
开发者ID:robinlu,项目名称:QuartzNetWebConsole,代码行数:12,代码来源:TriggersByJobController.cs


示例20: AddJobChainLink

        /// <summary>
        /// Add a chain mapping - when the Job identified by the first key completes
        /// the job identified by the second key will be triggered.
        /// </summary>
        /// <param name="firstJob">a JobKey with the name and group of the first job</param>
        /// <param name="secondJob">a JobKey with the name and group of the follow-up job</param>
        public void AddJobChainLink(JobKey firstJob, JobKey secondJob)
        {
            if (firstJob == null || secondJob == null)
            {
                throw new ArgumentException("Key cannot be null!");
            }
            if (firstJob.Name == null || secondJob.Name == null)
            {
                throw new ArgumentException("Key cannot have a null name!");
            }

            chainLinks.Add(firstJob, secondJob);
        }
开发者ID:jvilalta,项目名称:quartznet,代码行数:19,代码来源:JobChainingJobListener.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JobStatus类代码示例发布时间:2022-05-24
下一篇:
C# JobHostConfiguration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap