本文整理了Java中org.quartz.Scheduler.deleteJob()
方法的一些代码示例,展示了Scheduler.deleteJob()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.deleteJob()
方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:deleteJob
[英]Delete the identified Job
from the Scheduler - and any associated Trigger
s.
[中]从调度程序中删除标识的Job
以及任何相关的Trigger
s。
代码示例来源:origin: AxonFramework/AxonFramework
private void cancelSchedule(JobKey jobKey) {
try {
if (!scheduler.deleteJob(jobKey)) {
logger.warn("The job belonging to this token could not be deleted.");
}
} catch (SchedulerException e) {
throw new DeadlineException("An error occurred while cancelling a timer for a deadline manager", e);
}
}
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
/**
* 删除定时任务
*/
public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
try {
scheduler.deleteJob(getJobKey(jobId));
} catch (SchedulerException e) {
log.error("删除定时任务失败", e);
}
}
}
代码示例来源:origin: kairosdb/kairosdb
@Override
public void cancel(JobKey jobKey) throws KairosDBException
{
checkNotNull(jobKey);
try
{
scheduler.deleteJob(jobKey);
}
catch (SchedulerException e)
{
throw new KairosDBException("Failed to delete job " + jobKey, e);
}
}
代码示例来源:origin: Netflix/Priam
public void deleteTask(String name) throws SchedulerException, ParseException {
scheduler.deleteJob(new JobKey(name, Scheduler.DEFAULT_GROUP));
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Unschedule and delete a job.
*
* @param jobName Job name
* @throws JobException when there is anything wrong unschedule the job
*/
public void unscheduleJob(String jobName)
throws JobException {
if (this.scheduledJobs.containsKey(jobName)) {
try {
this.scheduler.getScheduler().deleteJob(this.scheduledJobs.remove(jobName));
} catch (SchedulerException se) {
LOG.error("Failed to unschedule and delete job " + jobName, se);
throw new JobException("Failed to unschedule and delete job " + jobName, se);
}
}
}
代码示例来源:origin: azkaban/azkaban
/**
* Unregister a job given the groupname. Since unregister might be called when
* concurrently removing projects, so synchronized is added to ensure thread safety.
*/
public synchronized void unregisterJob(final String jobName, final String groupName) throws
SchedulerException {
checkJobExistence(jobName, groupName);
this.scheduler.deleteJob(new JobKey(jobName, groupName));
}
代码示例来源:origin: apache/incubator-gobblin
/** {@inheritDoc} */
@Override protected void doUnschedule(JobSpecSchedule existingSchedule) {
Preconditions.checkNotNull(existingSchedule);
Preconditions.checkArgument(existingSchedule instanceof QuartzJobSchedule);
QuartzJobSchedule quartzSchedule = (QuartzJobSchedule)existingSchedule;
try {
_scheduler.getScheduler().deleteJob(quartzSchedule.getQuartzTrigger().getJobKey());
} catch (SchedulerException e) {
throw new RuntimeException("Unscheduling failed for " + existingSchedule.getJobSpec()
+ ":" + e, e);
}
}
代码示例来源:origin: hs-web/hsweb-framework
private void deleteJob(ScheduleJobEntity jobEntity) {
JobKey jobKey = createJobKey(jobEntity);
try {
if (scheduler.checkExists(jobKey)) {
scheduler.deleteJob(jobKey);
}
} catch (SchedulerException e) {
throw new BusinessException("更新任务失败", e, 500);
}
}
代码示例来源:origin: gocd/gocd
private void unscheduleJob(String pipelineName) {
try {
JobKey jobKey = jobKey(pipelineName, PIPELINE_TRIGGGER_TIMER_GROUP);
if (quartzScheduler.getJobDetail(jobKey) != null) {
quartzScheduler.unscheduleJob(triggerKey(pipelineName, PIPELINE_TRIGGGER_TIMER_GROUP));
quartzScheduler.deleteJob(jobKey);
}
} catch (SchedulerException e) {
LOG.error("Could not unschedule quartz jobs", e);
}
}
代码示例来源:origin: apache/incubator-gobblin
boolean isEarlyStopped = jobLauncher.isEarlyStopped();
if (!isEarlyStopped && runOnce && this.scheduledJobs.containsKey(jobName)) {
this.scheduler.getScheduler().deleteJob(this.scheduledJobs.remove(jobName));
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public void cancelSchedule(ScheduleToken scheduleToken) {
if (!(scheduleToken instanceof QuartzScheduleToken)) {
throw new IllegalArgumentException("The given ScheduleToken was not provided by this scheduler.");
}
Assert.state(initialized, () -> "Scheduler is not yet initialized");
QuartzScheduleToken reference = (QuartzScheduleToken) scheduleToken;
try {
if (!scheduler.deleteJob(jobKey(reference.getJobIdentifier(), reference.getGroupIdentifier()))) {
logger.warn("The job belonging to this token could not be deleted.");
}
} catch (SchedulerException e) {
throw new SchedulingException("An error occurred while cancelling a timer for a saga", e);
}
}
代码示例来源:origin: gocd/gocd
private void unscheduleExistingBackupJob() throws SchedulerException {
if (quartzScheduler.getJobDetail(jobKey()) != null) {
quartzScheduler.unscheduleJob(triggerKey());
quartzScheduler.deleteJob(jobKey());
}
}
代码示例来源:origin: quartz-scheduler/quartz
if (!jobGroupsToNeverDelete.contains(groupName)) {
for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
scheduler.deleteJob(key);
log.info("Deleting all jobs in group: {}", group);
for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group))) {
scheduler.deleteJob(key);
if(!jobGroupsToNeverDelete.contains(key.getGroup())) {
log.info("Deleting job: {}", key);
scheduler.deleteJob(key);
代码示例来源:origin: quartz-scheduler/quartz
if (!jobGroupsToNeverDelete.contains(groupName)) {
for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
scheduler.deleteJob(key);
log.info("Deleting all jobs in group: {}", group);
for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group))) {
scheduler.deleteJob(key);
if(!jobGroupsToNeverDelete.contains(key.getGroup())) {
log.info("Deleting job: {}", key);
scheduler.deleteJob(key);
代码示例来源:origin: kiegroup/jbpm
@Override
public boolean removeJob(JobHandle jobHandle) {
GlobalQuartzJobHandle quartzJobHandle = (GlobalQuartzJobHandle) jobHandle;
try {
boolean removed = scheduler.deleteJob(jobKey(quartzJobHandle.getJobName(), quartzJobHandle.getJobGroup()));
return removed;
} catch (SchedulerException e) {
throw new RuntimeException("Exception while removing job", e);
} catch (RuntimeException e) {
SchedulerMetaData metadata;
try {
metadata = scheduler.getMetaData();
if (metadata.getJobStoreClass().isAssignableFrom(JobStoreCMT.class)) {
return true;
}
} catch (SchedulerException e1) {
}
throw e;
}
}
代码示例来源:origin: quartz-scheduler/quartz
sched.deleteJob(detail.getKey());
} else {
throw e;
代码示例来源:origin: quartz-scheduler/quartz
sched.deleteJob(detail.getKey());
} else {
throw e;
代码示例来源:origin: Dreampie/Resty
/**
* 停止任务
*/
public void stop() {
long id = quartzKey.getId();
String name = quartzKey.getName();
String group = quartzKey.getGroup();
SchedulerFactory factory = Quartzer.getSchedulerFactory();
try {
if (factory != null) {
Scheduler scheduler = factory.getScheduler();
TriggerKey triggerKey = TriggerKey.triggerKey(TRIGGER_MARK + SEPARATOR + name + SEPARATOR + id, GROUP_MARK + SEPARATOR + group + SEPARATOR + id);
Trigger trigger = scheduler.getTrigger(triggerKey);
if (trigger != null) {
scheduler.pauseTrigger(triggerKey);
scheduler.unscheduleJob(triggerKey);
scheduler.deleteJob(trigger.getJobKey());
Quartzer.removeQuartzJob(this);
}
}
} catch (Exception e) {
throw new QuartzException("Can't stop job.", e);
}
}
代码示例来源:origin: bill1012/AdminEAP
/**
* 删除
*/
public void deleteJob(ScheduleJob scheduleJob) throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
scheduler.deleteJob(jobKey);
}
代码示例来源:origin: Exrick/x-boot
/**
* 删除定时任务
* @param jobClassName
*/
public void delete(String jobClassName){
try {
scheduler.pauseTrigger(TriggerKey.triggerKey(jobClassName));
scheduler.unscheduleJob(TriggerKey.triggerKey(jobClassName));
scheduler.deleteJob(JobKey.jobKey(jobClassName));
} catch (Exception e) {
throw new XbootException("删除定时任务失败");
}
}
内容来源于网络,如有侵权,请联系作者删除!