本文整理汇总了Java中org.quartz.Trigger.setStartTime方法的典型用法代码示例。如果您正苦于以下问题:Java Trigger.setStartTime方法的具体用法?Java Trigger.setStartTime怎么用?Java Trigger.setStartTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.Trigger
的用法示例。
在下文中一共展示了Trigger.setStartTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.quartz.Trigger; //导入方法依赖的package包/类
/**
* Check that all properties are properly set
*/
public void init() throws SchedulerException
{
PropertyCheck.mandatory(this, "scheduler", scheduler);
PropertyCheck.mandatory(this, "transactionService", transactionService);
PropertyCheck.mandatory(this, "repoUsageComponent", repoUsageComponent);
PropertyCheck.mandatory(this, "jobLockService", jobLockService);
// Trigger the scheduled updates
final JobDetail jobDetail = new JobDetail("rmj", Scheduler.DEFAULT_GROUP, RepoUsageMonitorJob.class);
jobDetail.getJobDataMap().put("RepoUsageMonitor", this);
final Trigger trigger = TriggerUtils.makeHourlyTrigger(12); // every 12 hours
trigger.setStartTime(new Date(System.currentTimeMillis() + 60L * 60L * 1000L)); // one hour from now
trigger.setName("rmt");
trigger.setGroup(Scheduler.DEFAULT_GROUP);
repoUsageComponent.observeRestrictions(this);
// Unschedule in case it was scheduled in an earlier retry of the transaction
scheduler.unscheduleJob("rmt", Scheduler.DEFAULT_GROUP);
scheduler.scheduleJob(jobDetail, trigger);
}
示例2: getTrigger
import org.quartz.Trigger; //导入方法依赖的package包/类
/**
* Build the cron trigger
*
* @return The trigger
* @throws Exception
*/
public Trigger getTrigger() throws Exception
{
Trigger trigger = new CronTrigger(getBeanName(), Scheduler.DEFAULT_GROUP, getCronExpression());
if (this.startDelay > 0)
{
trigger.setStartTime(new Date(System.currentTimeMillis() + this.startDelay));
}
JobDetail jd = super.getJobDetail();
if (jd != null)
{
String jobName = super.getJobDetail().getKey().getName();
if (jobName != null && !jobName.isEmpty())
{
trigger.setJobName(jobName);
}
String jobGroup = super.getJobDetail().getKey().getGroup();
if (jobGroup != null && !jobGroup.isEmpty())
{
trigger.setJobGroup(jobGroup);
}
}
return trigger;
}