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


Java Trigger.setStartTime方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:RepoUsageMonitor.java

示例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;
}
 
開發者ID:Alfresco,項目名稱:alfresco-core,代碼行數:30,代碼來源:CronTriggerBean.java


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