本文整理了Java中org.quartz.Scheduler.startDelayed()
方法的一些代码示例,展示了Scheduler.startDelayed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.startDelayed()
方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:startDelayed
[英]Calls {#start()} after the indicated number of seconds. (This call does not block). This can be useful within applications that have initializers that create the scheduler immediately, before the resources needed by the executing jobs have been fully initialized.
[中]在指定的秒数后调用{#start()}。(此呼叫不阻塞)。这在具有初始值设定项的应用程序中非常有用,这些初始值设定项可以在执行作业所需的资源完全初始化之前立即创建调度程序。
代码示例来源:origin: kiegroup/jbpm
@Override
public synchronized void initScheduler(TimerService timerService) {
this.globalTimerService = timerService;
timerServiceCounter.incrementAndGet();
if (scheduler == null) {
try {
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.startDelayed(START_DELAY);
} catch (SchedulerException e) {
throw new RuntimeException("Exception when initializing QuartzSchedulerService", e);
}
if (isTransactional()) {
// if it's transactional service directly - meaning data base job store
// disable auto init of timers
System.setProperty("org.jbpm.rm.init.timer", "false");
}
}
}
代码示例来源:origin: quartz-scheduler/quartz
scheduler.startDelayed(startDelay);
log.info("Scheduler will start in " + startDelay + " seconds.");
代码示例来源:origin: quartz-scheduler/quartz
scheduler.startDelayed(startDelay);
log.info("Scheduler will start in " + startDelay + " seconds.");
代码示例来源:origin: quartz-scheduler/quartz
scheduler.startDelayed(startDelay);
log("Scheduler will start in " + startDelay + " seconds.");
代码示例来源:origin: quartz-scheduler/quartz
scheduler.startDelayed(startDelay);
log("Scheduler will start in " + startDelay + " seconds.");
代码示例来源:origin: org.rhq/rhq-enterprise-server
public void startDelayed(int delay) throws SchedulerException {
scheduler.startDelayed(delay);
}
}
代码示例来源:origin: org.rhq/rhq-enterprise-server
public void startDelayed(int delay) throws SchedulerException {
this.scheduler.startDelayed(delay);
}
代码示例来源:origin: myschedule/myschedule-quartz-extra
public void startDelayed(int seconds) {
try {
scheduler.startDelayed(seconds);
} catch (SchedulerException e) {
throw new QuartzRuntimeException(e);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz
@Override
public void startDelayed(int seconds) throws QuartzException {
try {
delegate.startDelayed(seconds);
} catch (SchedulerException e) {
throw new QuartzException(e);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-quartz
@Override
public void startDelayed(int seconds) throws QuartzException {
try {
delegate.startDelayed(seconds);
} catch (SchedulerException e) {
throw new QuartzException(e);
}
}
代码示例来源:origin: OpenWiseSolutions/openhub-framework
@Override
public void startDelayed(int seconds) throws SchedulerException {
getScheduler().startDelayed(seconds);
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-handler
public void init() {
if (!enabled) {
LOGGER.info("Job schedular disabled. No jobs will be triggered. This is also true for particularly enabled jobs.");
return;
}
for (ScheduledJob scheduledJob : scheduledJobs) {
// LOGGER.info(dataSourceConfig.getItemName() + " " + dataSourceConfig.getUrl());
// HibernateDataSourceHarvesterJob dataSourceJob = new HibernateDataSourceHarvesterJob();
// dataSourceJob.init(dataSourceConfig);
scheduleJob(scheduledJob);
}
try {
scheduler.startDelayed(startupDelayInSeconds);
LOGGER.info("Scheduler will start jobs in {}s ...", startupDelayInSeconds);
} catch (SchedulerException e) {
LOGGER.error("Could not start scheduler.", e);
}
}
代码示例来源:origin: 52North/SOS
public void init() {
if (!enabled) {
LOGGER.info("Job schedular disabled. No jobs will be triggered. This is also true for particularly enabled jobs.");
return;
}
for (ScheduledJob scheduledJob : scheduledJobs) {
// LOGGER.info(dataSourceConfig.getItemName() + " " + dataSourceConfig.getUrl());
// HibernateDataSourceHarvesterJob dataSourceJob = new HibernateDataSourceHarvesterJob();
// dataSourceJob.init(dataSourceConfig);
scheduleJob(scheduledJob);
}
try {
scheduler.startDelayed(startupDelayInSeconds);
LOGGER.info("Scheduler will start jobs in {}s ...", startupDelayInSeconds);
} catch (SchedulerException e) {
LOGGER.error("Could not start scheduler.", e);
}
}
代码示例来源:origin: org.jbpm/jbpm-flow
@Override
public synchronized void initScheduler(TimerService timerService) {
this.globalTimerService = timerService;
timerServiceCounter.incrementAndGet();
if (scheduler == null) {
try {
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.startDelayed(START_DELAY);
} catch (SchedulerException e) {
throw new RuntimeException("Exception when initializing QuartzSchedulerService", e);
}
if (isTransactional()) {
// if it's transactional service directly - meaning data base job store
// disable auto init of timers
System.setProperty("org.jbpm.rm.init.timer", "false");
}
}
}
代码示例来源:origin: org.n52.series-api/io
/**
* Runs all scheduled tasks
*/
public void init() {
if (!enabled) {
LOGGER.info("Job schedular disabled. No jobs will be triggered. "
+ "This is also true for particularly enabled jobs.");
return;
}
scheduledJobs.stream()
.filter(scheduledJob -> scheduledJob.isEnabled())
.forEach(scheduledJob -> scheduleJob(scheduledJob));
try {
scheduler.startDelayed(startupDelayInSeconds);
LOGGER.info("Scheduler will start jobs in {}s ...", startupDelayInSeconds);
} catch (SchedulerException e) {
LOGGER.error("Could not start scheduler.", e);
}
}
代码示例来源:origin: com.thesett.jenerator.utils/jenerator_util_dropwizard_0.9
/** {@inheritDoc} */
public void start() throws SchedulerException {
LOG.info("Sundial Initializer Manager loaded, initializing Scheduler...");
boolean startOnLoad =
Boolean.valueOf(configProperties.getProperty("startOnLoad", DEFAULT_START_ON_LOAD)).booleanValue();
int startDelay = Integer.parseInt(configProperties.getProperty("startDelay", DEFAULT_START_DELAY));
int threadPoolSize = Integer.parseInt(configProperties.getProperty("threadPoolSize", DEFAULT_THREAD_POOL_SIZE));
boolean globalLockOnLoad =
Boolean.valueOf(configProperties.getProperty("globalLockOnLoad", DEFAULT_LOCK_ON_LOAD)).booleanValue();
SundialJobScheduler.createScheduler(threadPoolSize);
if (startOnLoad) {
if (startDelay <= 0) {
// Start now
SundialJobScheduler.getScheduler().start();
LOG.info("Sundial scheduler has been started.");
} else {
// Start delayed
SundialJobScheduler.getScheduler().startDelayed(startDelay);
LOG.info("Sundial scheduler will start in " + startDelay + " seconds.");
}
}
if (globalLockOnLoad) {
SundialJobScheduler.lockScheduler();
LOG.info("Sundial scheduler has been locked.");
}
LOG.info("Scheduler has been started.");
}
代码示例来源:origin: ChronixDB/chronix.server
/**
* This method sets up a scheduled deletion job.
*/
private void scheduledDeletion() {
System.setProperty("org.quartz.threadPool.threadCount", "3");
SchedulerFactory sf = new StdSchedulerFactory();
try {
scheduler = sf.getScheduler();
Trigger trigger = newTrigger()
.withIdentity("Data_Retention_Trigger")
.startNow()
.withSchedule(dailyAtHourAndMinute(removeDailyAt, 0))
.build();
JobDetail deletionJob = newJob(RetentionJob.class)
.withIdentity("Data_Retention_Job")
.usingJobData(RetentionConstants.RETENTION_URL, retentionURL)
.build();
scheduler.scheduleJob(deletionJob, trigger);
scheduler.startDelayed(180);
} catch (SchedulerException e) {
LOGGER.warn("Got an scheduler exception.", e);
}
}
代码示例来源:origin: org.n52.series-api/proxy-dao
public void init() {
if (!enabled) {
LOGGER.info("Job schedular disabled. No jobs will be triggered." +
" This is also true for particularly enabled jobs.");
return;
}
Set<DataSourceConfiguration> configuredServices = configurationProvider.getDataSource()
.stream()
.filter(t -> t.getJob().isEnabled())
.collect(toSet());
insertRepository.removeNonMatchingServices(configuredServices);
configurationProvider.getDataSource().stream()
.peek(config -> LOGGER.info("{} {}", config.getItemName(), config.getUrl()))
.map(config -> {
DataSourceHarvesterJob job = new DataSourceHarvesterJob();
job.init(config);
return job;
}).forEach(this::scheduleJob);
try {
scheduler.startDelayed(startupDelayInSeconds);
LOGGER.info("Scheduler will start jobs in {}s ...", startupDelayInSeconds);
} catch (SchedulerException e) {
LOGGER.error("Could not start scheduler.", e);
}
}
代码示例来源:origin: OpenWiseSolutions/openhub-framework
/**
* Start scheduler after method {@link #start()} was called and {@link ApplicationReadyEvent} was handled.
*/
private void startScheduler() {
if (startCalled && applicationReadyEventHandled) {
try {
if (getStartupDelay() == null) {
LOG.info("Starting Quartz Scheduler '{}'.", scheduler.getSchedulerName());
scheduler.start();
} else {
LOG.info("Starting Quartz Scheduler '{}' with delay {}s.", scheduler.getSchedulerName(),
getStartupDelay());
scheduler.startDelayed(getStartupDelay());
}
schedulerStarted = true;
} catch (SchedulerException ex) {
throw new SchedulingException("Could not start Quartz Scheduler", ex);
}
}
}
代码示例来源:origin: org.apache.camel/camel-quartz
/**
* To force starting the quartz scheduler
*
* @throws SchedulerException can be thrown if error starting
*/
public void startScheduler() throws SchedulerException {
for (JobToAdd add : jobsToAdd) {
doAddJob(add.getJob(), add.getTrigger());
}
jobsToAdd.clear();
if (!getScheduler().isStarted()) {
if (getStartDelayedSeconds() > 0) {
LOG.info("Starting Quartz scheduler: " + getScheduler().getSchedulerName() + " delayed: " + getStartDelayedSeconds() + " seconds.");
try {
getScheduler().startDelayed(getStartDelayedSeconds());
} catch (NoSuchMethodError e) {
LOG.warn("Your version of Quartz is too old to support delayed startup! "
+ "Starting Quartz scheduler immediately : " + getScheduler().getSchedulerName());
getScheduler().start();
}
} else {
LOG.info("Starting Quartz scheduler: {}", getScheduler().getSchedulerName());
getScheduler().start();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!