本文整理了Java中org.quartz.Trigger.setJobName()
方法的一些代码示例,展示了Trigger.setJobName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.setJobName()
方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:setJobName
[英]Set the name of the associated org.quartz.JobDetail
.
[中]设置关联的org.quartz.JobDetail
的名称。
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
/**
* <p>
* Create a <code>Trigger</code> with the given name, and group.
* </p>
*
* @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
*
* @exception IllegalArgumentException
* if name is null or empty, or the group is an empty string.
*/
public Trigger(String name, String group, String jobName, String jobGroup) {
setName(name);
setGroup(group);
setJobName(jobName);
setJobGroup(jobGroup);
}
代码示例来源:origin: quartz/quartz-all
/**
* <p>
* Create a <code>Trigger</code> with the given name, and group.
* </p>
*
* @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
*
* @exception IllegalArgumentException
* if name is null or empty, or the group is an empty string.
*/
public Trigger(String name, String group, String jobName, String jobGroup) {
setName(name);
setGroup(group);
setJobName(jobName);
setJobGroup(jobGroup);
}
代码示例来源:origin: org.kuali.kfs/kfs-core
public Trigger getTrigger() {
Trigger trigger = null;
if (getClass().equals(SimpleTriggerDescriptor.class)) {
trigger = new SimpleTrigger(name, group);
}
else {
trigger = new CronTrigger(name, group);
}
trigger.setJobName(jobName);
trigger.setJobGroup(group);
trigger.setStartTime(dateTimeService.getCurrentDate());
completeTriggerDescription(trigger);
return trigger;
}
代码示例来源:origin: org.terracotta.modules/tim-tree-map-cache
public static void start() throws SchedulerException {
if (_enabled) {
_sched.start();
JobDetail jobDetail = null;
try {
jobDetail = new JobDetail("SimpleEvictorJob",
null,
Class.forName(_evictorClass));
} catch (ClassNotFoundException e) {
jobDetail = new JobDetail("SimpleEvictorJob",
null,
SimpleTTLEvictor.class);
}
Trigger trigger;
try {
trigger = new CronTrigger("TCEvictionTrigger","TCEvictionGroup",_evictorIntervalTrigger);
} catch (ParseException e) {
_LOGGER.info("Could not parse evictor interval trigger expression '"+_evictorIntervalTrigger+"'");
_LOGGER.info("Falling back on default behavior: Evictor will run every hour");
trigger = TriggerUtils.makeHourlyTrigger();
trigger.setName("TCEvictionTrigger");
trigger.setGroup("TCEvictionGroup");
}
trigger.setStartTime(new Date()); // start right now
trigger.setJobName(jobDetail.getName());
_sched.scheduleJob(jobDetail, trigger);
System.out.println("");
}
}
代码示例来源:origin: opencast/opencast
/**
* Set the schedule and start or restart the scheduler.
*/
public void schedule() {
if (quartz == null || schedulerPeriod <= 0) {
logger.debug("Cancel scheduling of workspace cleaner due to invalid scheduling period");
return;
}
logger.debug("Scheduling workspace cleaner to run every {} seconds.", schedulerPeriod);
try {
final Trigger trigger = TriggerUtils.makeSecondlyTrigger(schedulerPeriod);
trigger.setStartTime(new Date());
trigger.setName(TRIGGER_NAME);
trigger.setGroup(TRIGGER_GROUP);
trigger.setJobName(JOB_NAME);
trigger.setJobGroup(JOB_GROUP);
if (quartz.getTriggersOfJob(JOB_NAME, JOB_GROUP).length == 0) {
quartz.scheduleJob(trigger);
} else {
quartz.rescheduleJob(TRIGGER_NAME, TRIGGER_GROUP, trigger);
}
} catch (Exception e) {
logger.error("Error scheduling Quartz job", e);
}
}
代码示例来源:origin: pentaho/pentaho-platform
quartzTrigger.setJobName( jobId );
quartzTrigger.setJobGroup( jobKey.getUserName() );
代码示例来源:origin: org.ikasan/ikasan-framework
recoveryTrigger.setGroup(getTriggerGroup());
recoveryTrigger.setJobName(INITIATOR_JOB_NAME);
recoveryTrigger.setJobGroup(getJobGroup());
代码示例来源:origin: org.rhq/rhq-enterprise-server
public static Trigger getFireOnceTrigger(JobDetail jobDetail, Date fireOn) {
Trigger trigger = new SimpleTrigger(jobDetail.getName(), jobDetail.getGroup(), fireOn);
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
return trigger;
}
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
private void rescheduleJob(JobExecutionContext context) throws JobExecutionException {
try {
Scheduler scheduler = context.getScheduler();
Trigger oldTrigger = context.getTrigger();
DateTime newStartTime = new DateTime().plusMinutes(5);
String newTriggerName = BatchJobUtil.getTriggerName(SupervisorApprovalJob.class, newStartTime);
Trigger newTrigger = new SimpleTrigger(newTriggerName, oldTrigger.getGroup(), newStartTime.toDate());
newTrigger.setJobName(oldTrigger.getJobName());
newTrigger.setJobGroup(oldTrigger.getJobGroup());
LOG.info("Rescheduing " + newTrigger.getFullJobName() + " to be run on " + newTrigger.getStartTime());
scheduler.rescheduleJob(oldTrigger.getName(), oldTrigger.getGroup(), newTrigger);
} catch (SchedulerException se) {
LOG.error("Failure to execute job due to SchedulerException", se);
// throw new JobExecutionException(se);
}
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
private void rescheduleJob(JobExecutionContext context) throws JobExecutionException {
try {
Scheduler scheduler = context.getScheduler();
Trigger oldTrigger = context.getTrigger();
DateTime newStartTime = new DateTime().plusMinutes(5);
String newTriggerName = BatchJobUtil.getTriggerName(PayrollApprovalJob.class, newStartTime);
Trigger newTrigger = new SimpleTrigger(newTriggerName, oldTrigger.getGroup(), newStartTime.toDate());
newTrigger.setJobName(oldTrigger.getJobName());
newTrigger.setJobGroup(oldTrigger.getJobGroup());
LOG.info("Rescheduing " + newTrigger.getFullJobName() + " to be run on " + newTrigger.getStartTime());
scheduler.rescheduleJob(oldTrigger.getName(), oldTrigger.getGroup(), newTrigger);
} catch (SchedulerException se) {
LOG.error("Failure to execute job due to SchedulerException", se);
// throw new JobExecutionException(se);
}
}
代码示例来源:origin: org.ikasan/ikasan-framework
@Override
protected void startInitiator() throws InitiatorOperationException
{
try
{
jobDetail = new JobDetail(INITIATOR_JOB_NAME,getJobGroup(), QuartzStatefulJob.class);
//quartz api requires that first trigger registration needs to use scheduler.scheduleJob(jobDetail,firstTrigger)
//whilst subsequent trigger registrations for the same job use scheduler.scheduleJob(subsequentTrigger)
// - where all subsequentTriggers have the jobName and jobGroup set
boolean firstTrigger = true;
for(Trigger trigger: triggers){
trigger.setGroup(getTriggerGroup());
if (firstTrigger){
scheduler.scheduleJob(jobDetail, trigger);
firstTrigger = false;
}else{
trigger.setJobGroup(getJobGroup());
trigger.setJobName(INITIATOR_JOB_NAME);
scheduler.scheduleJob(trigger);
}
}
logger.info("Initiator [" + this.getName() + "] started.");
}
catch (SchedulerException e)
{
throw new InitiatorOperationException("Failed to start Initiator [" + this.getName() + "] [" + "].", e);
}
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
@SuppressWarnings("unchecked")
private void scheduleJob(Class<?> jobClass, DateTime jobDate, Map<String, String> jobGroupDataMap, Map<String, String> jobDataMap) throws SchedulerException {
if(jobDate == null) {
return;
}
String jobGroupName = BatchJobUtil.getJobGroupName(jobClass, jobGroupDataMap);
String jobName = BatchJobUtil.getJobName(jobClass, jobDataMap);
String[] jobNames = getScheduler().getJobNames(jobGroupName);
if (!ArrayUtils.contains(jobNames, jobName)) {
jobDataMap.put("date", jobDate.toString());
Map<String, String> mergedDataMap = MapUtils.merge(jobGroupDataMap, jobDataMap);
JobDetail jobDetail = new JobDetail(jobName, jobGroupName, jobClass, false, true, false);
jobDetail.setJobDataMap(new JobDataMap(mergedDataMap));
String triggerGroupName = BatchJobUtil.getTriggerGroupName(jobClass, MapUtils.merge(jobGroupDataMap, jobDataMap));
String triggerName = BatchJobUtil.getTriggerName(jobClass, jobDate);
Trigger trigger = new SimpleTrigger(triggerName, triggerGroupName, jobDate.toDate());
trigger.setJobGroup(jobGroupName);
trigger.setJobName(jobName);
LOG.info("Scheduling " + jobDetail.getFullName() + " to be run on " + jobDate);
this.updateStatus(jobDetail, BatchJobService.SCHEDULED_JOB_STATUS_CODE);
getScheduler().scheduleJob(jobDetail, trigger);
}
}
代码示例来源:origin: deas/alfresco
/**
* Build the cron trigger
*
* @return The trigger
* @throws Exception
*/
public Trigger getTrigger() throws Exception
{
Trigger trigger = new CronTrigger(getBeanName(), Scheduler.DEFAULT_GROUP, getCronExpression());
if (this.startDelay > 0)
{
trigger.setStartTime(new Date(System.currentTimeMillis() + this.startDelay));
}
JobDetail jd = super.getJobDetail();
if (jd != null)
{
String jobName = super.getJobDetail().getKey().getName();
if (jobName != null && !jobName.isEmpty())
{
trigger.setJobName(jobName);
}
String jobGroup = super.getJobDetail().getKey().getGroup();
if (jobGroup != null && !jobGroup.isEmpty())
{
trigger.setJobGroup(jobGroup);
}
}
return trigger;
}
代码示例来源:origin: org.apache.camel/camel-quartz
trigger.setJobName(job.getName());
trigger.setJobGroup(job.getGroup());
scheduler.scheduleJob(trigger);
trigger.setJobName(job.getName());
trigger.setJobGroup(job.getGroup());
scheduler.scheduleJob(trigger);
代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1
void scheduleJob(final JobRunnerKey jobRunnerKey, final Trigger trigger) throws SchedulerServiceException {
if (getQuartzJob(jobRunnerKey) != null) {
trigger.setJobGroup(QUARTZ_JOB_GROUP);
trigger.setJobName(jobRunnerKey.toString());
scheduleJob(trigger);
return;
}
try {
final JobDetail quartzJob = new JobDetail();
quartzJob.setGroup(QUARTZ_JOB_GROUP);
quartzJob.setName(jobRunnerKey.toString());
quartzJob.setJobClass(Quartz1Job.class);
quartzJob.setDurability(false);
getScheduler().scheduleJob(quartzJob, trigger);
} catch (SchedulerException se) {
throw checked("Unable to create the Quartz job and trigger", se);
}
}
代码示例来源:origin: org.rhq/rhq-enterprise-server
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
代码示例来源:origin: quartz/quartz-all
Trigger trigger = (Trigger)iter.next();
trigger.setJobName(detail.getName());
trigger.setJobGroup(detail.getGroup());
代码示例来源:origin: org.rhq/rhq-enterprise-server
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
} else if (trigger.getJobName() != null
代码示例来源:origin: quartz/quartz-all
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
} else if (trigger.getJobName() != null
内容来源于网络,如有侵权,请联系作者删除!