本文整理匯總了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;
}
}
示例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());
}
示例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;
}
}
示例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());
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
}