当前位置: 首页>>代码示例>>Java>>正文


Java Trigger.setName方法代码示例

本文整理汇总了Java中org.quartz.Trigger.setName方法的典型用法代码示例。如果您正苦于以下问题:Java Trigger.setName方法的具体用法?Java Trigger.setName怎么用?Java Trigger.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.Trigger的用法示例。


在下文中一共展示了Trigger.setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: triggerJob

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * <p>
 * Trigger the identified <code>{@link org.quartz.Job}</code> (execute it
 * now) - with a non-volatile trigger.
 * </p>
 */
public void triggerJob(SchedulingContext ctxt, String jobName,
        String groupName, JobDataMap data) throws SchedulerException {
    validateState();

    if(groupName == null) {
        groupName = Scheduler.DEFAULT_GROUP;
    }
    
    Trigger trig = new org.quartz.SimpleTrigger(newTriggerId(),
            Scheduler.DEFAULT_MANUAL_TRIGGERS, jobName, groupName,
            new Date(), null, 0, 0);
    trig.setVolatility(false);
    trig.computeFirstFireTime(null);
    if(data != null) {
        trig.setJobDataMap(data);
    }

    boolean collision = true;
    while (collision) {
        try {
            resources.getJobStore().storeTrigger(ctxt, trig, false);
            collision = false;
        } catch (ObjectAlreadyExistsException oaee) {
            trig.setName(newTriggerId());
        }
    }

    notifySchedulerThread(trig.getNextFireTime().getTime());
    notifySchedulerListenersSchduled(trig);
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:37,代码来源:QuartzScheduler.java

示例3: triggerJobWithVolatileTrigger

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * <p>
 * Trigger the identified <code>{@link org.quartz.Job}</code> (execute it
 * now) - with a volatile trigger.
 * </p>
 */
public void triggerJobWithVolatileTrigger(SchedulingContext ctxt,
        String jobName, String groupName, JobDataMap data) throws SchedulerException {
    validateState();

    if(groupName == null) {
        groupName = Scheduler.DEFAULT_GROUP;
    }
    
    Trigger trig = new org.quartz.SimpleTrigger(newTriggerId(),
            Scheduler.DEFAULT_MANUAL_TRIGGERS, jobName, groupName,
            new Date(), null, 0, 0);
    trig.setVolatility(true);
    trig.computeFirstFireTime(null);
    if(data != null) {
        trig.setJobDataMap(data);
    }
    
    boolean collision = true;
    while (collision) {
        try {
            resources.getJobStore().storeTrigger(ctxt, trig, false);
            collision = false;
        } catch (ObjectAlreadyExistsException oaee) {
            trig.setName(newTriggerId());
        }
    }

    notifySchedulerThread(trig.getNextFireTime().getTime());
    notifySchedulerListenersSchduled(trig);
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:37,代码来源:QuartzScheduler.java


注:本文中的org.quartz.Trigger.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。