Quartz.NET scheduler.Interrupt(jobKey)中断所有活动作业 [英] Quartz.NET scheduler.Interrupt(jobKey) is interrupting all active jobs

查看:73
本文介绍了Quartz.NET scheduler.Interrupt(jobKey)中断所有活动作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该方法是否应该仅中断jobKey定义的工作?我已经进行了一些测试,它似乎中断了当前正在运行的所有活动作业.

Should the method only interrupt the job as defined by the jobKey? I've ran some tests and it seems to interrupt all of the active jobs currently running.

我正在使用一个宁静的Web api连接到远程调度程序以创建/中断/删除作业.

I am using a restful web api to connect to the remote scheduler to create/interrupt/delete jobs.

Api服务代码:

public void DeleteJob(JobKey jobKey)
{
    var scheduler = _clientQuartzScheduler.GetScheduler();

    var executingJobs = scheduler.GetCurrentlyExecutingJobs();

    if (executingJobs.Any(x => x.JobDetail.Key.Equals(jobKey)))
    {
        scheduler.Interrupt(jobKey);
    }

    scheduler.DeleteJob(jobKey);
}

Quartz远程调度程序应用程序设置为:

Quartz remote scheduler app settings are:

<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

<add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz" />
<add key="quartz.scheduler.exporter.port" value="555" />
<add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler" />
<add key="quartz.scheduler.exporter.channelType" value="tcp" />
<add key="quartz.scheduler.exporter.channelName" value="httpQuartz" />
<add key="quartz.scheduler.exporter.rejectRemoteRequests" value="false" />

<add key="quartz.jobStore.clustered" value="false" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz" />   

<add key="quartz.dataSource.default.provider" value="MySql-65" />
<add key="quartz.dataSource.default.connectionStringName" value="DatabaseConnectionString" />

api客户端设置为:

The api client settings are:

properties["quartz.scheduler.instanceName"] = "RemoteClient";
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.threadPool.threadCount"] = "0";
properties["quartz.scheduler.proxy.address"] = address;

推荐答案

我很抱歉,但最终我发现了这个问题.原来是使用 NInjectJobFactory 的我的注册码配置错误.

I apologize but I finally found the issue on my end. It turned out to be a misconfiguration with my registration code using a NInjectJobFactory.

基本上,每个作业执行只运行一个作业实例,因此我为停止作业中断而设置的标志在所有作业执行中共享,从而停止了所有作业!

Basically, there was only a single job instance running for each job execution so the flag I was setting to stop the job being interrupted was shared amongst all job executions, thereby stopping all the jobs!

这篇关于Quartz.NET scheduler.Interrupt(jobKey)中断所有活动作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆