Java Code Examples for org.quartz.impl.triggers.SimpleTriggerImpl#setJobDataMap()
The following examples show how to use
org.quartz.impl.triggers.SimpleTriggerImpl#setJobDataMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelayedAsynchronousServiceCallProxy.java From rice with Educational Community License v2.0 | 6 votes |
protected void scheduleMessage(PersistedMessageBO message) throws SchedulerException { LOG.debug("Scheduling execution of a delayed asynchronous message."); Scheduler scheduler = KSBServiceLocator.getScheduler(); JobDataMap jobData = new JobDataMap(); jobData.put(MessageServiceExecutorJob.MESSAGE_KEY, message); JobDetailImpl jobDetail = new JobDetailImpl("Delayed_Asynchronous_Call-" + Math.random(), "Delayed_Asynchronous_Call", MessageServiceExecutorJob.class); jobDetail.setJobDataMap(jobData); scheduler.getListenerManager().addJobListener( new MessageServiceExecutorJobListener()); SimpleTriggerImpl trigger = new SimpleTriggerImpl("Delayed_Asynchronous_Call_Trigger-" + Math.random(), "Delayed_Asynchronous_Call", message.getQueueDate()); trigger.setJobDataMap(jobData);// 1.6 bug required or derby will choke scheduler.scheduleJob(jobDetail, trigger); }
Example 2
Source File: DefaultExceptionServiceImpl.java From rice with Educational Community License v2.0 | 6 votes |
public void scheduleExecution(Throwable throwable, PersistedMessageBO message, String description) throws Exception { KSBServiceLocator.getMessageQueueService().delete(message); PersistedMessageBO messageCopy = message.copy(); Scheduler scheduler = KSBServiceLocator.getScheduler(); JobDataMap jobData = new JobDataMap(); jobData.put(MessageServiceExecutorJob.MESSAGE_KEY, messageCopy); JobDetailImpl jobDetail = new JobDetailImpl("Exception_Message_Job " + Math.random(), "Exception Messaging", MessageServiceExecutorJob.class); jobDetail.setJobDataMap(jobData); if (!StringUtils.isBlank(description)) { jobDetail.setDescription(description); } scheduler.getListenerManager().addJobListener( new MessageServiceExecutorJobListener()); SimpleTriggerImpl trigger = new SimpleTriggerImpl("Exception_Message_Trigger " + Math.random(), "Exception Messaging", messageCopy .getQueueDate()); trigger.setJobDataMap(jobData);// 1.6 bug required or derby will choke scheduler.scheduleJob(jobDetail, trigger); }
Example 3
Source File: SimpleTriggerFactoryBean.java From spring-analysis-note with MIT License | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name != null ? this.name : toString()); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 4
Source File: SimpleTriggerFactoryBean.java From java-technology-stack with MIT License | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name != null ? this.name : toString()); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 5
Source File: SimpleTriggerFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name); sti.setGroup(this.group); if (this.jobDetail != null) { sti.setJobKey(this.jobDetail.getKey()); } sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 6
Source File: SimpleTriggerFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void afterPropertiesSet() { if (this.name == null) { this.name = this.beanName; } if (this.group == null) { this.group = Scheduler.DEFAULT_GROUP; } if (this.jobDetail != null) { this.jobDataMap.put("jobDetail", this.jobDetail); } if (this.startDelay > 0 || this.startTime == null) { this.startTime = new Date(System.currentTimeMillis() + this.startDelay); } SimpleTriggerImpl sti = new SimpleTriggerImpl(); sti.setName(this.name); sti.setGroup(this.group); sti.setJobKey(this.jobDetail.getKey()); sti.setJobDataMap(this.jobDataMap); sti.setStartTime(this.startTime); sti.setRepeatInterval(this.repeatInterval); sti.setRepeatCount(this.repeatCount); sti.setPriority(this.priority); sti.setMisfireInstruction(this.misfireInstruction); sti.setDescription(this.description); this.simpleTrigger = sti; }
Example 7
Source File: MessagingServiceImpl.java From rice with Educational Community License v2.0 | 5 votes |
private void scheduleJob() { LOG.debug("Queueing processing job"); try { Scheduler scheduler = KSBServiceLocator.getScheduler(); if (synchronous) { LOG.debug("Invoking job synchronously in Thread " + Thread.currentThread()); MessageProcessingJob job = new MessageProcessingJob(messageId, mode, user, cause); job.run(); } else { String uniqueTriggerName = jobName + "-Trigger-" + System.currentTimeMillis() + Math.random(); SimpleTriggerImpl trigger = new SimpleTriggerImpl(uniqueTriggerName, jobGroup + "-Trigger"); LOG.debug("Scheduling trigger: " + trigger); JobDataMap data = new JobDataMap(); data.put("mode", mode.name()); data.put("user", user); data.put("cause", cause); data.put("messageId", messageId); trigger.setJobName(jobName); trigger.setJobGroup(jobGroup); trigger.setJobDataMap(data); scheduler.scheduleJob(trigger); } } catch (SchedulerException se) { throw new RuntimeException(se); } }
Example 8
Source File: StdJDBCDelegate.java From lams with GNU General Public License v2.0 | 4 votes |
/** * <p> * Select all of the triggers for jobs that are requesting recovery. The * returned trigger objects will have unique "recoverXXX" trigger names and * will be in the <code>{@link * org.quartz.Scheduler}.DEFAULT_RECOVERY_GROUP</code> * trigger group. * </p> * * <p> * In order to preserve the ordering of the triggers, the fire time will be * set from the <code>COL_FIRED_TIME</code> column in the <code>TABLE_FIRED_TRIGGERS</code> * table. The caller is responsible for calling <code>computeFirstFireTime</code> * on each returned trigger. It is also up to the caller to insert the * returned triggers to ensure that they are fired. * </p> * * @param conn * the DB Connection * @return an array of <code>{@link org.quartz.Trigger}</code> objects */ public List<OperableTrigger> selectTriggersForRecoveringJobs(Connection conn) throws SQLException, IOException, ClassNotFoundException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn .prepareStatement(rtp(SELECT_INSTANCES_RECOVERABLE_FIRED_TRIGGERS)); ps.setString(1, instanceId); setBoolean(ps, 2, true); rs = ps.executeQuery(); long dumId = System.currentTimeMillis(); LinkedList<OperableTrigger> list = new LinkedList<OperableTrigger>(); while (rs.next()) { String jobName = rs.getString(COL_JOB_NAME); String jobGroup = rs.getString(COL_JOB_GROUP); String trigName = rs.getString(COL_TRIGGER_NAME); String trigGroup = rs.getString(COL_TRIGGER_GROUP); long firedTime = rs.getLong(COL_FIRED_TIME); long scheduledTime = rs.getLong(COL_SCHED_TIME); int priority = rs.getInt(COL_PRIORITY); @SuppressWarnings("deprecation") SimpleTriggerImpl rcvryTrig = new SimpleTriggerImpl("recover_" + instanceId + "_" + String.valueOf(dumId++), Scheduler.DEFAULT_RECOVERY_GROUP, new Date(scheduledTime)); rcvryTrig.setJobName(jobName); rcvryTrig.setJobGroup(jobGroup); rcvryTrig.setPriority(priority); rcvryTrig.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY); JobDataMap jd = selectTriggerJobDataMap(conn, trigName, trigGroup); jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_NAME, trigName); jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_GROUP, trigGroup); jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS, String.valueOf(firedTime)); jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS, String.valueOf(scheduledTime)); rcvryTrig.setJobDataMap(jd); list.add(rcvryTrig); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }