本文整理了Java中org.quartz.Trigger.getJobDataMap()
方法的一些代码示例,展示了Trigger.getJobDataMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.getJobDataMap()
方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:getJobDataMap
[英]Get the JobDataMap
that is associated with the Trigger
.
Changes made to this map during job execution are not re-persisted, and in fact typically result in an IllegalStateException
.
[中]获取与Trigger
关联的JobDataMap
。
在作业执行期间对此映射所做的更改不会重新持久化,事实上通常会导致IllegalStateException
。
代码示例来源:origin: ltsopensource/light-task-scheduler
private QuartzJobContext buildQuartzJobContext(QuartzJobContext quartzJobContext, Trigger trigger) {
JobDataMap triggerJobDataMap = trigger.getJobDataMap();
JobDetail jobDetail = (JobDetail) triggerJobDataMap.get("jobDetail");
// 要执行的类
MethodInvoker methodInvoker = (MethodInvoker) jobDetail.getJobDataMap().get("methodInvoker");
Map<String, Object> jobDataMap = new HashMap<String, Object>();
jobDataMap.putAll(triggerJobDataMap);
jobDataMap.putAll(jobDetail.getJobDataMap());
jobDataMap.remove("jobDetail");
jobDataMap.remove("methodInvoker");
quartzJobContext.setJobDataMap(jobDataMap);
if (methodInvoker != null) {
quartzJobContext.setJobExecution(new MethodInvokeJobExecution(methodInvoker));
} else {
Class<? extends Job> jobClass = jobDetail.getJobClass();
try {
Job job = jobClass.newInstance();
quartzJobContext.setJobExecution(new JobDetailJobExecution(job));
} catch (Exception e) {
throw new QuartzProxyException("Instance JobClass[" + (jobClass == null ? null : jobClass.getName()) + "] error", e);
}
}
return quartzJobContext;
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
private QuartzJobContext buildQuartzJobContext(QuartzJobContext quartzJobContext, Trigger trigger) {
JobDataMap triggerJobDataMap = trigger.getJobDataMap();
JobDetail jobDetail = (JobDetail) triggerJobDataMap.get("jobDetail");
// 要执行的类
MethodInvoker methodInvoker = (MethodInvoker) jobDetail.getJobDataMap().get("methodInvoker");
Map<String, Object> jobDataMap = new HashMap<String, Object>();
jobDataMap.putAll(triggerJobDataMap);
jobDataMap.putAll(jobDetail.getJobDataMap());
jobDataMap.remove("jobDetail");
jobDataMap.remove("methodInvoker");
quartzJobContext.setJobDataMap(jobDataMap);
if (methodInvoker != null) {
quartzJobContext.setJobExecution(new MethodInvokeJobExecution(methodInvoker));
} else {
Class<? extends Job> jobClass = jobDetail.getJobClass();
try {
Job job = jobClass.newInstance();
quartzJobContext.setJobExecution(new JobDetailJobExecution(job));
} catch (Exception e) {
throw new QuartzProxyException("Instance JobClass[" + (jobClass == null ? null : jobClass.getName()) + "] error", e);
}
}
return quartzJobContext;
}
}
代码示例来源:origin: spring-projects/spring-framework
JobDetail jobDetail = (JobDetail) trigger.getJobDataMap().remove("jobDetail");
if (triggerExists) {
if (jobDetail != null && this.jobDetails != null &&
代码示例来源:origin: org.springframework/spring-context-support
JobDetail jobDetail = (JobDetail) trigger.getJobDataMap().remove("jobDetail");
if (triggerExists) {
if (jobDetail != null && this.jobDetails != null &&
代码示例来源:origin: quartz-scheduler/quartz
/**
* <p>
* Create a JobExcecutionContext with the given context data.
* </p>
*/
public JobExecutionContextImpl(Scheduler scheduler,
TriggerFiredBundle firedBundle, Job job) {
this.scheduler = scheduler;
this.trigger = firedBundle.getTrigger();
this.calendar = firedBundle.getCalendar();
this.jobDetail = firedBundle.getJobDetail();
this.job = job;
this.recovering = firedBundle.isRecovering();
this.fireTime = firedBundle.getFireTime();
this.scheduledFireTime = firedBundle.getScheduledFireTime();
this.prevFireTime = firedBundle.getPrevFireTime();
this.nextFireTime = firedBundle.getNextFireTime();
this.jobDataMap = new JobDataMap();
this.jobDataMap.putAll(jobDetail.getJobDataMap());
this.jobDataMap.putAll(trigger.getJobDataMap());
}
代码示例来源:origin: quartz-scheduler/quartz
/**
* <p>
* Create a JobExcecutionContext with the given context data.
* </p>
*/
public JobExecutionContextImpl(Scheduler scheduler,
TriggerFiredBundle firedBundle, Job job) {
this.scheduler = scheduler;
this.trigger = firedBundle.getTrigger();
this.calendar = firedBundle.getCalendar();
this.jobDetail = firedBundle.getJobDetail();
this.job = job;
this.recovering = firedBundle.isRecovering();
this.fireTime = firedBundle.getFireTime();
this.scheduledFireTime = firedBundle.getScheduledFireTime();
this.prevFireTime = firedBundle.getPrevFireTime();
this.nextFireTime = firedBundle.getNextFireTime();
this.jobDataMap = new JobDataMap();
this.jobDataMap.putAll(jobDetail.getJobDataMap());
this.jobDataMap.putAll(trigger.getJobDataMap());
}
代码示例来源:origin: quartz-scheduler/quartz
public static CompositeData toCompositeData(Trigger trigger) {
try {
return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
new Object[] {
trigger.getKey().getName(),
trigger.getKey().getGroup(),
trigger.getJobKey().getName(),
trigger.getJobKey().getGroup(),
trigger.getDescription(),
JobDataMapSupport.toTabularData(trigger
.getJobDataMap()),
trigger.getCalendarName(),
((OperableTrigger)trigger).getFireInstanceId(),
trigger.getMisfireInstruction(),
trigger.getPriority(), trigger.getStartTime(),
trigger.getEndTime(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(),
trigger.getFinalFireTime() });
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1
@Nullable
@Override
protected byte[] getSerializedParameters(Trigger trigger) {
return (byte[]) trigger.getJobDataMap().get(QUARTZ_PARAMETERS_KEY);
}
代码示例来源:origin: org.opensingular/singular-app-commons
@Override
public void addTrigger(Trigger trigger, JobDetail jobDetail) throws SchedulerException {
trigger.getJobDataMap().put(SINGULAR_JOB_DETAIL_KEY, jobDetail);
addTriggerToScheduler(trigger);
}
代码示例来源:origin: org.opensingular/singular-schedule
/**
* Find the job detail of the specified trigger.
*
* @param trigger the trigger.
* @return the job detail.
*/
private JobDetail findJobDetail(Trigger trigger) {
return (JobDetail) trigger.getJobDataMap().remove(SINGULAR_JOB_DETAIL_KEY);
}
代码示例来源:origin: org.opensingular/singular-flow-schedule
/**
* Add a trigger with the specified job detail.
*
* @param trigger the trigger.
* @param jobDetail the job detail.
* @throws SchedulerException if could not start Quartz Scheduler.
*/
public void addTrigger(Trigger trigger, JobDetail jobDetail) throws SchedulerException {
trigger.getJobDataMap().put(JOB_DETAIL_KEY, jobDetail);
addTriggerToScheduler(trigger);
}
代码示例来源:origin: org.opensingular/singular-flow-schedule
/**
* Find the job detail of the specified trigger.
*
* @param trigger the trigger.
* @return the job detail.
*/
private JobDetail findJobDetail(Trigger trigger) {
return (JobDetail) trigger.getJobDataMap().remove(JOB_DETAIL_KEY);
}
代码示例来源:origin: org.opensingular/singular-schedule
/**
* Add a trigger with the specified job detail.
*
* @param trigger the trigger.
* @param jobDetail the job detail.
* @throws SchedulerException if could not start Quartz Scheduler.
*/
@Override
public void addTrigger(Trigger trigger, JobDetail jobDetail) throws SchedulerException {
trigger.getJobDataMap().put(SINGULAR_JOB_DETAIL_KEY, jobDetail);
addTriggerToScheduler(trigger);
}
代码示例来源:origin: net.sourceforge.kivu4j/job-example
@Override
public void doProcess(JobExecutionContext context) {
// 取出数据
JobDataMap data = context.getTrigger().getJobDataMap();
Timetable timetable = (Timetable)data.get(Consts.TIMETABLE);
logger.info("喔......!");
logger.info(timetable.toString());
}
代码示例来源:origin: org.apache.camel/camel-quartz2
private void checkTriggerIsNonConflicting(Trigger trigger) {
JobDataMap jobDataMap = trigger.getJobDataMap();
String routeIdFromTrigger = jobDataMap.getString("routeId");
if (routeIdFromTrigger != null && !routeIdFromTrigger.equals(routeId)) {
throw new IllegalArgumentException("Trigger key " + trigger.getKey() + " is already used by route: " + routeIdFromTrigger + ". Cannot re-use it for another route: " + routeId);
}
}
代码示例来源:origin: org.opensingular/flow-schedule
/**
* Add trigger and the trigger's job detail.
*
* @param trigger the trigger.
* @throws SchedulerException if could not start Quartz Scheduler.
*/
public void addTrigger(Trigger trigger) throws SchedulerException {
addJobToScheduler((JobDetail) trigger.getJobDataMap().get(JOB_DETAIL_KEY));
addTriggerToScheduler(trigger);
}
/**
代码示例来源:origin: org.opensingular/singular-schedule
/**
* Add trigger and the trigger's job detail.
*
* @param trigger the trigger.
* @throws SchedulerException if could not start Quartz Scheduler.
*/
@Override
public void addTrigger(Trigger trigger) throws SchedulerException {
addJobToScheduler((JobDetail) trigger.getJobDataMap().get(SINGULAR_JOB_DETAIL_KEY));
addTriggerToScheduler(trigger);
}
/**
代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1
public Trigger buildTrigger(final JobId jobId, final JobConfig jobConfig)
throws SchedulerServiceException {
final byte[] parameters = parameterMapSerializer.serializeParameters(jobConfig.getParameters());
final Trigger trigger = buildTrigger(jobConfig.getSchedule());
trigger.setGroup(QUARTZ_TRIGGER_GROUP);
trigger.setName(jobId.toString());
trigger.getJobDataMap().put(QUARTZ_PARAMETERS_KEY, parameters);
return trigger;
}
代码示例来源:origin: Evolveum/midpoint
private void deleteRedirectTriggers(@NotNull String oid) throws SchedulerException {
LOGGER.trace("Going to remove obsolete redirect triggers");
Scheduler scheduler = taskManager.getExecutionManager().getQuartzScheduler();
List<? extends Trigger> existingTriggers = scheduler.getTriggersOfJob(TaskQuartzImplUtil.createJobKeyForTaskOid(oid));
for (Trigger trigger : existingTriggers) {
if (trigger.getJobDataMap().containsKey(REDIRECT_FLAG)) {
LOGGER.trace("Removing obsolete redirect trigger {}", trigger);
scheduler.unscheduleJob(trigger.getKey());
}
}
}
}
代码示例来源:origin: bingoohuang/quartz-glass
public SimpleTriggerForm(Trigger trigger) {
this.startTime = Dates.copy(trigger.getStartTime());
this.endTime = Dates.copy(trigger.getEndTime());
this.dataMap = JobDataMapUtils.toProperties(trigger.getJobDataMap());
this.repeatCount = ((SimpleTrigger) trigger).getRepeatCount();
this.intervalInMilliseconds = (int) ((SimpleTrigger) trigger).getRepeatInterval();
}
内容来源于网络,如有侵权,请联系作者删除!