當前位置: 首頁>>代碼示例>>Java>>正文


Java TriggerFiredBundle.getJobDetail方法代碼示例

本文整理匯總了Java中org.quartz.spi.TriggerFiredBundle.getJobDetail方法的典型用法代碼示例。如果您正苦於以下問題:Java TriggerFiredBundle.getJobDetail方法的具體用法?Java TriggerFiredBundle.getJobDetail怎麽用?Java TriggerFiredBundle.getJobDetail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.quartz.spi.TriggerFiredBundle的用法示例。


在下文中一共展示了TriggerFiredBundle.getJobDetail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
public Job newJob(TriggerFiredBundle bundle, Scheduler Scheduler) throws SchedulerException {

        JobDetail jobDetail = bundle.getJobDetail();
        Class<? extends Job> jobClass = jobDetail.getJobClass();
        try {
            if(log.isDebugEnabled()) {
                log.debug(
                    "Producing instance of Job '" + jobDetail.getKey() + 
                    "', class=" + jobClass.getName());
            }
            
            return jobClass.newInstance();
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "Problem instantiating class '"
                            + jobDetail.getJobClass().getName() + "'", e);
            throw se;
        }
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:SimpleJobFactory.java

示例2: JobExecutionContextImpl

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/**
 * <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());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:JobExecutionContextImpl.java

示例3: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

        JobDetail jobDetail = bundle.getJobDetail();
        Class jobClass = jobDetail.getJobClass();
        try {
            if(log.isDebugEnabled()) {
                log.debug(
                    "Producing instance of Job '" + jobDetail.getFullName() + 
                    "', class=" + jobClass.getName());
            }
            
            return (Job) jobClass.newInstance();
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "Problem instantiating class '"
                            + jobDetail.getJobClass().getName() + "'", e);
            throw se;
        }
    }
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:20,代碼來源:SimpleJobFactory.java

示例4: JobExecutionContext

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/**
 * <p>
 * Create a JobExcecutionContext with the given context data.
 * </p>
 */
public JobExecutionContext(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());
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:23,代碼來源:JobExecutionContext.java

示例5: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
public Job newJob(final TriggerFiredBundle triggerFiredBundle, final Scheduler schdlr) throws SchedulerException {
    // Get the job detail so we can get the job class
    final JobDetail jobDetail = triggerFiredBundle.getJobDetail();
    final Class jobClass = jobDetail.getJobClass();

    try {
        // Get a new instance of that class from Guice so we can do dependency injection
        return (Job) injector.getInstance(jobClass);
    } catch (Exception e) {
        // Something went wrong.  Print out the stack trace here so SLF4J doesn't hide it.
        LOGGER.error("Problem with building job.", e);

        // Rethrow the exception as an UnsupportedOperationException
        throw new UnsupportedOperationException(e);
    }
}
 
開發者ID:SoftTeco,項目名稱:st-toolset,代碼行數:18,代碼來源:GuiceJobFactory.java

示例6: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/** {@inheritDoc} */
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    Class<ReportJob> jobClass = getJobClass(jobDetail);
    
    ReportJob job = null;
    
    try {
        job = jobClass.newInstance();
        job.setReportd(getReportd());
        return job;
    } catch (Throwable e) {
        SchedulerException se = new SchedulerException("failed to create job class: "+ jobDetail.getJobClass().getName()+"; "+
                                                       e.getLocalizedMessage(), e);
        throw se;
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:19,代碼來源:ReportJobFactory.java

示例7: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/** {@inheritDoc} */
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    Class<ImportJob> jobClass = getJobClass(jobDetail);
    
    ImportJob job = null;
    
    try {
        job = jobClass.newInstance();
        job.setProvisioner(getProvisioner());
        return job;
    } catch (Throwable e) {
        SchedulerException se = new SchedulerException("failed to create job class: "+jobDetail.getJobClass().getName()+"; "+
                                                       e.getLocalizedMessage(), e);
        throw se;
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:19,代碼來源:ImportJobFactory.java

示例8: triggerFired

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/**
 * <p>
 * Inform the <code>JobStore</code> that the scheduler is now firing the
 * given <code>Trigger</code> (executing its associated <code>Job</code>),
 * that it had previously acquired (reserved).
 * </p>
 */
public TriggerFiredBundle triggerFired(SchedulingContext ctxt,
        Trigger trigger) {

    synchronized (lock) {
        TriggerWrapper tw = (TriggerWrapper) triggersByFQN.get(TriggerWrapper
                .getTriggerNameKey(trigger));
        // was the trigger deleted since being acquired?
        if (tw == null || tw.trigger == null) {
            return null;
        }
        // was the trigger completed, paused, blocked, etc. since being acquired?
        if (tw.state != TriggerWrapper.STATE_ACQUIRED) {
            return null;
        }

        Calendar cal = null;
        if (tw.trigger.getCalendarName() != null) {
            cal = retrieveCalendar(ctxt, tw.trigger.getCalendarName());
            if(cal == null)
                return null;
        }
        Date prevFireTime = trigger.getPreviousFireTime();
        // in case trigger was replaced between acquiring and firering
        timeTriggers.remove(tw);            
        // call triggered on our copy, and the scheduler's copy
        tw.trigger.triggered(cal);
        trigger.triggered(cal);
        //tw.state = TriggerWrapper.STATE_EXECUTING;
        tw.state = TriggerWrapper.STATE_WAITING;

        TriggerFiredBundle bndle = new TriggerFiredBundle(retrieveJob(ctxt,
                trigger.getJobName(), trigger.getJobGroup()), trigger, cal,
                false, new Date(), trigger.getPreviousFireTime(), prevFireTime,
                trigger.getNextFireTime());

        JobDetail job = bndle.getJobDetail();

        if (job.isStateful()) {
            ArrayList trigs = getTriggerWrappersForJob(job.getName(), job
                    .getGroup());
            Iterator itr = trigs.iterator();
            while (itr.hasNext()) {
                TriggerWrapper ttw = (TriggerWrapper) itr.next();
                if(ttw.state == TriggerWrapper.STATE_WAITING) {
                    ttw.state = TriggerWrapper.STATE_BLOCKED;
                }
                if(ttw.state == TriggerWrapper.STATE_PAUSED) {
                    ttw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
                }
                timeTriggers.remove(ttw);
            }
            blockedJobs.add(JobWrapper.getJobNameKey(job));
        } else if (tw.trigger.getNextFireTime() != null) {
            synchronized (lock) {
                timeTriggers.add(tw);
            }
        }

        return bndle;
    }
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:69,代碼來源:RAMJobStore.java

示例9: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    MetricRegistry metricRegistry = autowireCapableBeanFactory.getBean(MetricRegistry.class);
    HistorianDAO historianDAO = autowireCapableBeanFactory.getBean(HistorianDAO.class);
    AfterDAO afterDAO = autowireCapableBeanFactory.getBean(AfterDAO.class);

    try {
        return new TriggerAwareLoggingJob(
                new HistorianJob(
                        new TimedJob(
                                new ErrorHandlingJob(
                                        (Job) autowireCapableBeanFactory.autowire(jobDetail.getJobClass(),
                                                AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false)
                                ),
                                metricRegistry
                        ),
                        Clock.systemUTC(),
                        scheduler.getSchedulerName(),
                        scheduler.getSchedulerInstanceId(),
                        historianDAO,
                        afterDAO
                )
        );
    } catch (Exception e) {
        throw new SchedulerException(
                "Problem instantiating class '"
                        + jobDetail.getJobClass().getName() + "'", e);
    }
}
 
開發者ID:taboola,項目名稱:taboola-cronyx,代碼行數:32,代碼來源:DelegatingQuartzJobFactory.java

示例10: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
    JobDetail jobDetail = bundle.getJobDetail();
    Class<? extends Job> jobClass = jobDetail.getJobClass();

    try {
        if (App.get().context() == null) {
            Environment.init();
        }

        if (log.isDebugEnabled()) {
            log.debug("Producing instance of Job '" + jobDetail.getKey() + "', class=" + jobClass.getName());
        }

        Job job = (Job) App.get().inject(jobClass);

        JobDataMap jobDataMap = new JobDataMap();
        jobDataMap.putAll(scheduler.getContext());
        jobDataMap.putAll(bundle.getJobDetail().getJobDataMap());
        jobDataMap.putAll(bundle.getTrigger().getJobDataMap());

        setBeanProps(job, jobDataMap);

        return job;
    } catch (Exception e) {
        System.out.println(Thread.currentThread().getName() + " ----------- " + App.get().context());

        SchedulerException se = new SchedulerException(
            "Problem instantiating class '" + jobDetail.getJobClass().getName() + "'", e);
        throw se;
    }
}
 
開發者ID:geetools,項目名稱:geeCommerce-Java-Shop-Software-and-PIM,代碼行數:33,代碼來源:GuicePropertySettingJobFactory.java

示例11: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle triggerFiredBundle, Scheduler scheduler)
    throws SchedulerException {
  checkNotNull(injector);
  JobDetail jobDetail = triggerFiredBundle.getJobDetail();
  Class jobClass = jobDetail.getJobClass();
  try {
    return (Job) injector.getInstance(jobClass);
  } catch (Exception e) {
    LOGGER.error(
        String.format("Error while creating job class [%s]: [%s].", jobClass, e.getMessage()), e);
    throw new SchedulerException(e);
  }
}
 
開發者ID:melphi,項目名稱:onplan,代碼行數:15,代碼來源:GuiceJobFactory.java

示例12: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
public Job newJob(final TriggerFiredBundle bundle, final Scheduler schedular)
		throws SchedulerException {
	JobDetail jobDetail = bundle.getJobDetail();
	String jobName = jobDetail.getKey().getName();
	try {
		return processorControllerFactory.getInjector(jobName).getInstance(ProcessorControllerJob.class);
	} 
	catch (Exception e) {
		LOG.log(Level.SEVERE, e.getMessage(), e);
		throw new SchedulerException(e);
	}
}
 
開發者ID:CTSIatUCSF,項目名稱:Crosslinks,代碼行數:13,代碼來源:GuiceJobFactory.java

示例13: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException
{
    JobDetail jobDetail = bundle.getJobDetail();
    Class<?> jobClass = jobDetail.getJobClass();
    Job job = (Job) guice.getInstance(jobClass);
    guice.injectMembers(job);
    return job;
}
 
開發者ID:Netflix,項目名稱:Raigad,代碼行數:10,代碼來源:GuiceJobFactory.java

示例14: newJob

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
@Override
@SuppressWarnings({
										"rawtypes",
										"unchecked"
})
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

	JobDetail jobDetail = bundle.getJobDetail();
	Class jobClass = jobDetail.getJobClass();
	return (Job) injector.getInstance(jobClass);

}
 
開發者ID:sigmah-dev,項目名稱:sigmah,代碼行數:13,代碼來源:GuiceJobFactory.java

示例15: triggersFired

import org.quartz.spi.TriggerFiredBundle; //導入方法依賴的package包/類
/**
 * <p>
 * Inform the <code>JobStore</code> that the scheduler is now firing the
 * given <code>Trigger</code> (executing its associated <code>Job</code>),
 * that it had previously acquired (reserved).
 * </p>
 */
public List<TriggerFiredResult> triggersFired(List<OperableTrigger> firedTriggers) {

    synchronized (lock) {
        List<TriggerFiredResult> results = new ArrayList<TriggerFiredResult>();

        for (OperableTrigger trigger : firedTriggers) {
            TriggerWrapper tw = triggersByKey.get(trigger.getKey());
            // was the trigger deleted since being acquired?
            if (tw == null || tw.trigger == null) {
                continue;
            }
            // was the trigger completed, paused, blocked, etc. since being acquired?
            if (tw.state != TriggerWrapper.STATE_ACQUIRED) {
                continue;
            }

            Calendar cal = null;
            if (tw.trigger.getCalendarName() != null) {
                cal = retrieveCalendar(tw.trigger.getCalendarName());
                if(cal == null)
                    continue;
            }
            Date prevFireTime = trigger.getPreviousFireTime();
            // in case trigger was replaced between acquiring and firing
            timeTriggers.remove(tw);
            // call triggered on our copy, and the scheduler's copy
            tw.trigger.triggered(cal);
            trigger.triggered(cal);
            //tw.state = TriggerWrapper.STATE_EXECUTING;
            tw.state = TriggerWrapper.STATE_WAITING;

            TriggerFiredBundle bndle = new TriggerFiredBundle(retrieveJob(
                    tw.jobKey), trigger, cal,
                    false, new Date(), trigger.getPreviousFireTime(), prevFireTime,
                    trigger.getNextFireTime());

            JobDetail job = bndle.getJobDetail();

            if (job.isConcurrentExectionDisallowed()) {
                ArrayList<TriggerWrapper> trigs = getTriggerWrappersForJob(job.getKey());
                for (TriggerWrapper ttw : trigs) {
                    if (ttw.state == TriggerWrapper.STATE_WAITING) {
                        ttw.state = TriggerWrapper.STATE_BLOCKED;
                    }
                    if (ttw.state == TriggerWrapper.STATE_PAUSED) {
                        ttw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
                    }
                    timeTriggers.remove(ttw);
                }
                blockedJobs.add(job.getKey());
            } else if (tw.trigger.getNextFireTime() != null) {
                synchronized (lock) {
                    timeTriggers.add(tw);
                }
            }

            results.add(new TriggerFiredResult(bndle));
        }
        return results;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:69,代碼來源:RAMJobStore.java


注:本文中的org.quartz.spi.TriggerFiredBundle.getJobDetail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。