Java Code Examples for org.quartz.JobDetail#setGroup()
The following examples show how to use
org.quartz.JobDetail#setGroup() .
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: QuarzSchedulerDAOImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@Override public void insertJob(Job spagobiJob) { logger.debug("IN"); try { Assert.assertNotNull(spagobiJob, "Input parameter [spagobiJob] cannot be null"); JobDetail quartzJob = QuartzNativeObjectsConverter.convertJobToNativeObject(spagobiJob); if (quartzJob.getDescription() == null) quartzJob.setDescription(""); String jobGroupName = quartzJob.getGroup() != null ? quartzJob.getGroup() : Scheduler.DEFAULT_GROUP; quartzJob.setGroup(jobGroupName); adjustTenant(quartzJob); scheduler.addJob(quartzJob, true); } catch (Throwable t) { throw new SpagoBIDAOException("An unexpected error occured while inserting job [" + spagobiJob + "]", t); } finally { logger.debug("OUT"); } }
Example 2
Source File: JobDetailSupport.java From AsuraFramework with Apache License 2.0 | 6 votes |
/** * @param cData * @return JobDetail */ public static JobDetail newJobDetail(CompositeData cData) { JobDetail jobDetail = new JobDetail(); int i = 0; jobDetail.setName((String) cData.get(ITEM_NAMES[i++])); jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++])); jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++])); try { Class c = Class.forName((String) cData.get(ITEM_NAMES[i++])); jobDetail.setJobClass(c); } catch (ClassNotFoundException cnfe) { /**/ } jobDetail.setJobDataMap(JobDataMapSupport .newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++]))); jobDetail.setVolatility((Boolean) cData.get(ITEM_NAMES[i++])); jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++])); jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++])); return jobDetail; }
Example 3
Source File: CmsTaskAct.java From Lottery with GNU General Public License v2.0 | 6 votes |
/** * 开始任务调度 * @param task 任务 * @param taskCode 任务名称 * @throws ParseException * @throws SchedulerException * @throws ClassNotFoundException */ private void startTask(CmsTask task,String taskCode) throws ParseException, SchedulerException, ClassNotFoundException{ String cronExpress=manager.getCronExpressionFromDB(task.getId()); System.out.println(cronExpress); if(cronExpress.indexOf("null")==-1){ JobDetail jobDetail = new JobDetail(); jobDetail.setName(taskCode); jobDetail.setGroup(Scheduler.DEFAULT_GROUP); jobDetail.setJobClass(getClassByTask(task.getJobClass())); //任务需要参数attr属性 jobDetail.setJobDataMap(getJobDataMap(task.getAttr())); CronTrigger cronTrigger = new CronTrigger("cron_" + taskCode,Scheduler.DEFAULT_GROUP, jobDetail.getName(),Scheduler.DEFAULT_GROUP); cronTrigger.setCronExpression(cronExpress); scheduler.scheduleJob(jobDetail, cronTrigger); } }
Example 4
Source File: QuarzSchedulerDAOImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
private void adjustTenant(JobDetail quartzJob) { String jobGroupName = quartzJob.getGroup(); LogMF.debug(logger, "before: jobGroupName = [{0}]", jobGroupName); jobGroupName = this.applyTenant(jobGroupName); LogMF.debug(logger, "after: jobGroupName = [{0}]", jobGroupName); quartzJob.setGroup(jobGroupName); }
Example 5
Source File: StdJDBCDelegate.java From AsuraFramework with Apache License 2.0 | 5 votes |
/** * <p> * Select the job to which the trigger is associated. * </p> * * @param conn * the DB Connection * @param triggerName * the name of the trigger * @param groupName * the group containing the trigger * @return the <code>{@link org.quartz.JobDetail}</code> object * associated with the given trigger * @throws SQLException * @throws ClassNotFoundException */ public JobDetail selectJobForTrigger(Connection conn, String triggerName, String groupName, ClassLoadHelper loadHelper) throws ClassNotFoundException, SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_FOR_TRIGGER)); ps.setString(1, triggerName); ps.setString(2, groupName); rs = ps.executeQuery(); if (rs.next()) { JobDetail job = new JobDetail(); job.setName(rs.getString(1)); job.setGroup(rs.getString(2)); job.setDurability(getBoolean(rs, 3)); job.setJobClass(loadHelper.loadClass(rs .getString(4))); job.setRequestsRecovery(getBoolean(rs, 5)); return job; } else { if (logger.isDebugEnabled()) { logger.debug("No job for trigger '" + groupName + "." + triggerName + "'."); } return null; } } finally { closeResultSet(rs); closeStatement(ps); } }
Example 6
Source File: SchedulerServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
protected void loadJob(JobDescriptor jobDescriptor) { JobDetail jobDetail = jobDescriptor.getJobDetail(); addJob(jobDetail); if (SCHEDULED_GROUP.equals(jobDetail.getGroup())) { jobDetail.setGroup(UNSCHEDULED_GROUP); addJob(jobDetail); } }
Example 7
Source File: SchedulerServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
@Override public void addScheduled(JobDetail job) { try { job.setGroup(SCHEDULED_GROUP); scheduler.addJob(job, true); } catch (SchedulerException ex) { throw new RuntimeException("Unable to add job to scheduled group: " + job.getName(), ex); } }
Example 8
Source File: SchedulerServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
@Override public void addUnscheduled(JobDetail job) { try { job.setGroup(UNSCHEDULED_GROUP); scheduler.addJob(job, true); } catch (SchedulerException ex) { throw new RuntimeException("Unable to add job to unscheduled group: " + job.getName(), ex); } }