当前位置: 首页>>代码示例>>Java>>正文


Java JobDetailImpl类代码示例

本文整理汇总了Java中org.quartz.impl.JobDetailImpl的典型用法代码示例。如果您正苦于以下问题:Java JobDetailImpl类的具体用法?Java JobDetailImpl怎么用?Java JobDetailImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobDetailImpl类属于org.quartz.impl包,在下文中一共展示了JobDetailImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: persistTrigger

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
/**
 * Persist the trigger in the Quartz scheduler.
 */
private VmSchedule persistTrigger(final VmSchedule schedule) throws SchedulerException {
	// The trigger for the common VM Job will the following convention :
	// schedule.id-subscription.id
	final String id = VmJob.format(schedule);
	final JobDetailImpl object = (JobDetailImpl) vmJobDetailFactoryBean.getObject();
	object.getJobDataMap().put("vmServicePlugin", this);
	final Trigger trigger = TriggerBuilder.newTrigger().withIdentity(id, SCHEDULE_TRIGGER_GROUP)
			.withSchedule(CronScheduleBuilder.cronSchedule(schedule.getCron()).inTimeZone(DateUtils.getApplicationTimeZone()))
			.forJob(object).usingJobData("subscription", schedule.getSubscription().getId())
			.usingJobData("operation", schedule.getOperation().name()).usingJobData("schedule", schedule.getId()).build();

	// Add this trigger
	vmSchedulerFactoryBean.getObject().scheduleJob(trigger);
	return schedule;
}
 
开发者ID:ligoj,项目名称:plugin-vm,代码行数:19,代码来源:VmResource.java

示例2: build

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
/**
 * Produce the <code>JobDetail</code> instance defined by this 
 * <code>JobBuilder</code>.
 * 
 * @return the defined JobDetail.
 */
public JobDetail build() {

    JobDetailImpl job = new JobDetailImpl();
    
    job.setJobClass(jobClass);
    job.setDescription(description);
    if(key == null)
        key = new JobKey(Key.createUniqueName(null), null);
    job.setKey(key); 
    job.setDurability(durability);
    job.setRequestsRecovery(shouldRecover);
    
    
    if(!jobDataMap.isEmpty())
        job.setJobDataMap(jobDataMap);
    
    return job;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JobBuilder.java

示例3: jobWasExecuted

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
public void jobWasExecuted(final JobExecutionContext context, JobExecutionException exp) {
    JobDetail jobDetail = context.getJobDetail();
    if(jobDetail instanceof JobDetailImpl){
        JobDetailImpl job = (JobDetailImpl)jobDetail;

        SchedulerLog log = new SchedulerLog();
        log.setJobName(job.getName());
        log.setGroupName(job.getGroup());

        log.setTriggerName(context.getTrigger().getKey().getName());
        log.setFireTime(context.getFireTime());
        log.setScheduledFireTime(context.getScheduledFireTime());
        log.setRefireCount(context.getRefireCount());
        log.setPreviousFireTime(context.getPreviousFireTime());
        log.setNextFireTime(context.getNextFireTime());
        log.setCreateTime(new Date());
        logMapper.insert(log);
    }
}
 
开发者ID:liuxx001,项目名称:bird-java,代码行数:20,代码来源:JobListener.java

示例4: getRunJobs

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
public Collection<RunJob> getRunJobs() {
	List<RunJob> result=new ArrayList<RunJob>();
	Session session=this.getSessionFactory().openSession();
	try{
		Collection<ReminderJob> runningJobs=this.loadReminderJobs(session);
		for(ReminderJob job:runningJobs){
			JobDetailImpl jobDetail=new JobDetailImpl();
			JobDefinition jobDef=buildJobDefinition(job,session);
			jobDetail.setJobClass(TaskReminderJob.class);
			RunJob runJob=new RunJob();
			runJob.setJobDefinition(jobDef);
			runJob.setJobDetail(jobDetail);
			result.add(runJob);
		}
	}finally{
		session.flush();
		session.close();
	}
	return result;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:21,代码来源:TaskReminderRunJobProvider.java

示例5: afterPropertiesSet

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException {
	prepare();

	// Use specific name if given, else fall back to bean name.
	String name = (this.name != null ? this.name : this.beanName);

	// Consider the concurrent flag to choose between stateful and stateless job.
	Class<?> jobClass = (this.concurrent ? MethodInvokingJob.class : StatefulMethodInvokingJob.class);

	// Build JobDetail instance.
	JobDetailImpl jdi = new JobDetailImpl();
	jdi.setName(name);
	jdi.setGroup(this.group);
	jdi.setJobClass((Class) jobClass);
	jdi.setDurability(true);
	jdi.getJobDataMap().put("methodInvoker", this);
	this.jobDetail = jdi;

	postProcessJobDetail(this.jobDetail);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:MethodInvokingJobDetailFactoryBean.java

示例6: makeJobDetail

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
private QuartzJobDetail makeJobDetail(CascadingClassLoadHelper cascadingClassLoadHelper, ResultSet rs) throws SQLException, ClassNotFoundException, IOException {
    JobDetailImpl jobDetail = new JobDetailImpl();

    String groupName = rs.getString(Constants.COL_JOB_GROUP);
    String jobName = rs.getString(Constants.COL_JOB_NAME);
    jobDetail.setName(jobName);
    jobDetail.setGroup(groupName);
    jobDetail.setDescription(rs.getString(Constants.COL_DESCRIPTION));
    jobDetail.setJobClass(
            cascadingClassLoadHelper.loadClass(rs.getString(Constants.COL_JOB_CLASS), Job.class)
    );
    jobDetail.setDurability(rs.getBoolean(Constants.COL_IS_DURABLE));
    jobDetail.setRequestsRecovery(rs.getBoolean(Constants.COL_REQUESTS_RECOVERY));

    Map<?, ?> map = (Map<?, ?>) getObjectFromBlob(rs, COL_JOB_DATAMAP);

    if (map != null) {
        jobDetail.setJobDataMap(new JobDataMap(map));
    }

    JobId jobId = new QuartzJobId(groupName, jobName, engine.getClusterName());

    QuartzJobDetail quartzJobDetail = new QuartzJobDetail(engine, jobId, jobDetail,
            rs.getTimestamp(WinderJDBCDelegate.COL_JOB_CREATED));
    return quartzJobDetail;
}
 
开发者ID:eBay,项目名称:Winder,代码行数:27,代码来源:QuartzSchedulerManager.java

示例7: retrieveJob

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
/**
 * Retrieve a job from redis
 * @param jobKey the job key detailing the identity of the job to be retrieved
 * @param jedis a thread-safe Redis connection
 * @return the {@link org.quartz.JobDetail} of the desired job
 * @throws JobPersistenceException if the desired job does not exist
 * @throws ClassNotFoundException
 */
public JobDetail retrieveJob(JobKey jobKey, T jedis) throws JobPersistenceException, ClassNotFoundException{
    final String jobHashKey = redisSchema.jobHashKey(jobKey);
    final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);

    final Map<String, String> jobDetailMap = jedis.hgetAll(jobHashKey);
    if(jobDetailMap == null || jobDetailMap.size() == 0){
        // desired job does not exist
        return null;
    }
    JobDetailImpl jobDetail = mapper.convertValue(jobDetailMap, JobDetailImpl.class);
    jobDetail.setKey(jobKey);

    final Map<String, String> jobData = jedis.hgetAll(jobDataMapHashKey);
    if(jobData != null && !jobData.isEmpty()){
        JobDataMap jobDataMap = new JobDataMap();
        jobDataMap.putAll(jobData);
        jobDetail.setJobDataMap(jobDataMap);
    }

    return jobDetail;
}
 
开发者ID:jlinn,项目名称:quartz-redis-jobstore,代码行数:30,代码来源:AbstractRedisStorage.java

示例8: serializeJobDetail

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
@Test
public void serializeJobDetail() throws Exception {
    JobDetail testJob = JobBuilder.newJob(TestJob.class)
            .withIdentity("testJob", "testGroup")
            .usingJobData("timeout", 42)
            .withDescription("I am describing a job!")
            .build();

    String json = mapper.writeValueAsString(testJob);
    Map<String, Object> jsonMap = mapper.readValue(json, new TypeReference<HashMap<String, String>>() {
    });

    assertThat(jsonMap, hasKey("name"));
    assertEquals(testJob.getKey().getName(), jsonMap.get("name"));
    assertThat(jsonMap, hasKey("group"));
    assertEquals(testJob.getKey().getGroup(), jsonMap.get("group"));
    assertThat(jsonMap, hasKey("jobClass"));
    assertEquals(testJob.getJobClass().getName(), jsonMap.get("jobClass"));

    JobDetailImpl jobDetail = mapper.readValue(json, JobDetailImpl.class);

    assertEquals(testJob.getKey().getName(), jobDetail.getKey().getName());
    assertEquals(testJob.getKey().getGroup(), jobDetail.getKey().getGroup());
    assertEquals(testJob.getJobClass(), jobDetail.getJobClass());
}
 
开发者ID:jlinn,项目名称:quartz-redis-jobstore,代码行数:26,代码来源:JobDetailMixinTest.java

示例9: scheduleMessage

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
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);
}
 
开发者ID:kuali,项目名称:rice,代码行数:19,代码来源:DelayedAsynchronousServiceCallProxy.java

示例10: scheduleExecution

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
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);
}
 
开发者ID:kuali,项目名称:rice,代码行数:23,代码来源:DefaultExceptionServiceImpl.java

示例11: testSchedulingJob

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
@Test
   public void testSchedulingJob() throws Exception {
Scheduler scheduler = KSBServiceLocator.getScheduler();
JobDataMap datMap = new JobDataMap();
datMap.put("yo", "yo");
JobDetailImpl jobDetail = new JobDetailImpl("myJob", null, TestJob.class);
jobDetail.setJobDataMap(datMap);

   TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger();
   triggerBuilder.startAt(new Date());
   triggerBuilder.withIdentity("i'm a trigger puller");
   triggerBuilder.usingJobData(datMap);
   triggerBuilder.withSchedule(SimpleScheduleBuilder.simpleSchedule().withRepeatCount(1).withIntervalInMilliseconds(1L));

   Trigger trigger = triggerBuilder.build();

scheduler.scheduleJob(jobDetail, trigger);


synchronized (TestJob.LOCK) {
    TestJob.LOCK.wait(30 * 1000);    
}

assertTrue("job never fired", TestJob.EXECUTED);
   }
 
开发者ID:kuali,项目名称:rice,代码行数:26,代码来源:QuartzTest.java

示例12: setUp

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
@BeforeClass
public void setUp() throws SchedulerException, InterruptedException {

  Config config = new Config();
  config.setProperty("hazelcast.logging.type", "slf4j");
  hazelcastInstance = Hazelcast.newHazelcastInstance(config);

  this.fSignaler = new SampleSignaler();

  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  this.jobStore = createJobStore("AbstractJobStoreTest");
  this.jobStore.initialize(loadHelper, this.fSignaler);
  this.jobStore.schedulerStarted();

  this.fJobDetail = new JobDetailImpl("job1", "jobGroup1", NoOpJob.class);
  this.fJobDetail.setDurability(true);
  this.jobStore.storeJob(this.fJobDetail, false);
}
 
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:21,代码来源:AbstractTestHazelcastJobStore.java

示例13: selectJobForTrigger

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
/**
 * <p>
 * Select the job to which the trigger is associated. Allow option to load actual job class or not. When case of
 * remove, we do not need to load the class, which in many cases, it's no longer exists.
 *
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return the <code>{@link org.quartz.JobDetail}</code> object
 *         associated with the given trigger
 * @throws SQLException
 * @throws ClassNotFoundException
 */
public JobDetail selectJobForTrigger(Connection conn, ClassLoadHelper loadHelper,
        TriggerKey triggerKey, boolean loadJobClass) throws ClassNotFoundException, SQLException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        ps = conn.prepareStatement(rtp(SELECT_JOB_FOR_TRIGGER));
        ps.setString(1, triggerKey.getName());
        ps.setString(2, triggerKey.getGroup());
        rs = ps.executeQuery();

        if (rs.next()) {
            JobDetailImpl job = new JobDetailImpl();
            job.setName(rs.getString(1));
            job.setGroup(rs.getString(2));
            job.setDurability(getBoolean(rs, 3));
            if (loadJobClass)
                job.setJobClass(loadHelper.loadClass(rs.getString(4), Job.class));
            job.setRequestsRecovery(getBoolean(rs, 5));
            
            return job;
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("No job for trigger '" + triggerKey + "'.");
            }
            return null;
        }
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:StdJDBCDelegate.java

示例14: newJobDetail

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
/**
 * @param cData
 * @return JobDetail
 */
public static JobDetail newJobDetail(CompositeData cData)
  throws ClassNotFoundException
{
    JobDetailImpl jobDetail = new JobDetailImpl();

    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++]));
    Class<?> jobClass = Class.forName((String) cData.get(ITEM_NAMES[i++]));
    @SuppressWarnings("unchecked")
    Class<? extends Job> jobClassTyped = (Class<? extends Job>)jobClass;
    jobDetail.setJobClass(jobClassTyped);
    jobDetail.setJobDataMap(JobDataMapSupport.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
    jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
    jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));

    return jobDetail;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:JobDetailSupport.java

示例15: scheduleNewTask

import org.quartz.impl.JobDetailImpl; //导入依赖的package包/类
private void scheduleNewTask(RollupTask task)
{
	try
	{
		logger.info("Scheduling rollup " + task.getName());
		Trigger trigger = createTrigger(task);
		JobDetailImpl jobDetail = createJobDetail(task, dataStore, hostName);
		scheduler.schedule(jobDetail, trigger);
		logger.info("Roll-up task " + jobDetail.getFullName() + " scheduled. Next execution time " + trigger.getNextFireTime());
	}
	catch (KairosDBException e)
	{
		logger.error("Failed to schedule new roll up task job " + task, e);
	}
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:16,代码来源:RollUpManager.java


注:本文中的org.quartz.impl.JobDetailImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。