org.quartz.Trigger.setGroup()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.quartz.Trigger.setGroup()方法的一些代码示例,展示了Trigger.setGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.setGroup()方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:setGroup

Trigger.setGroup介绍

[英]Set the name of this Trigger.
[中]设置此Trigger的名称。

代码示例

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the default group (<code>Scheduler.DEFAULT_GROUP</code>).
 * </p>
 * 
 * @deprecated use org.quartz.TriggerUtils instead!
 * 
 */
public static void setTriggerIdentity(Trigger trig, String name) {
  trig.setName(name);
  trig.setGroup(Scheduler.DEFAULT_GROUP);
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the default group (<code>Scheduler.DEFAULT_GROUP</code>).
 * </p>
 * 
 * @deprecated use org.quartz.TriggerUtils instead!
 * 
 */
public static void setTriggerIdentity(Trigger trig, String name) {
  trig.setName(name);
  trig.setGroup(Scheduler.DEFAULT_GROUP);
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the given group.
 * </p>
 * 
 * @deprecated use org.quartz.TriggerUtils instead!
 * 
 */
public static void setTriggerIdentity(Trigger trig, String name,
    String group) {
  trig.setName(name);
  trig.setGroup(group);
}

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the given group.
 * </p>
 * 
 * @deprecated use org.quartz.TriggerUtils instead!
 * 
 */
public static void setTriggerIdentity(Trigger trig, String name,
    String group) {
  trig.setName(name);
  trig.setGroup(group);
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the given group.
 * </p>
 * 
 * @param trig the tigger to change name to 
 * @param name the new trigger name
 * @param group the new trigger group
 */
public static void setTriggerIdentity(
    Trigger trig, String name, String group) {
  trig.setName(name);
  trig.setGroup(group);
}

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Set the given <code>Trigger</code>'s name to the given value, and its
 * group to the given group.
 * </p>
 * 
 * @param trig the tigger to change name to 
 * @param name the new trigger name
 * @param group the new trigger group
 */
public static void setTriggerIdentity(
    Trigger trig, String name, String group) {
  trig.setName(name);
  trig.setGroup(group);
}

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Create a <code>Trigger</code> with the given name, and group.
 * </p>
 * 
 * <p>
 * Note that the {@link #setJobName(String)}and
 * {@link #setJobGroup(String)}methods must be called before the <code>Trigger</code>
 * can be placed into a {@link Scheduler}.
 * </p>
 * 
 * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
 * 
 * @exception IllegalArgumentException
 *              if name is null or empty, or the group is an empty string.
 */
public Trigger(String name, String group) {
  setName(name);
  setGroup(group);
}

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Create a <code>Trigger</code> with the given name, and default group.
 * </p>
 * 
 * <p>
 * Note that the {@link #setJobName(String)}and
 * {@link #setJobGroup(String)}methods must be called before the <code>Trigger</code>
 * can be placed into a {@link Scheduler}.
 * </p>
 * 
 * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
 * 
 * @exception IllegalArgumentException
 *              if name is null or empty, or the group is an empty string.
 */
public Trigger(String name) {
  setName(name);
  setGroup(null);
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

/**
 * <p>
 * Create a <code>Trigger</code> with the given name, and group.
 * </p>
 * 
 * <p>
 * Note that the {@link #setJobName(String)}and
 * {@link #setJobGroup(String)}methods must be called before the <code>Trigger</code>
 * can be placed into a {@link Scheduler}.
 * </p>
 * 
 * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
 * 
 * @exception IllegalArgumentException
 *              if name is null or empty, or the group is an empty string.
 */
public Trigger(String name, String group) {
  setName(name);
  setGroup(group);
}

代码示例来源:origin: approvals/ApprovalTests.Java

/***********************************************************************/
 public static Trigger createTrigger(Trigger trigger, String name, String defaultGroup)
 {
  trigger.setName(name);
  trigger.setGroup(defaultGroup);
  trigger.setStartTime(new Date());
  trigger.setEndTime(new Date(Long.MAX_VALUE));
  return trigger;
 }
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

/**
 * <p>
 * Create a <code>Trigger</code> with the given name, and group.
 * </p>
 * 
 * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
 * 
 * @exception IllegalArgumentException
 *              if name is null or empty, or the group is an empty string.
 */
public Trigger(String name, String group, String jobName, String jobGroup) {
  setName(name);
  setGroup(group);
  setJobName(jobName);
  setJobGroup(jobGroup);
}

代码示例来源:origin: quartz/quartz-all

/**
 * <p>
 * Create a <code>Trigger</code> with the given name, and group.
 * </p>
 * 
 * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
 * 
 * @exception IllegalArgumentException
 *              if name is null or empty, or the group is an empty string.
 */
public Trigger(String name, String group, String jobName, String jobGroup) {
  setName(name);
  setGroup(group);
  setJobName(jobName);
  setJobGroup(jobGroup);
}

代码示例来源:origin: org.terracotta.modules/tim-tree-map-cache

public static void start() throws SchedulerException {
  if (_enabled) {
    _sched.start();
    JobDetail jobDetail = null;
    try {
      jobDetail = new JobDetail("SimpleEvictorJob",
                         null,
                         Class.forName(_evictorClass));
    } catch (ClassNotFoundException e) {
      jobDetail = new JobDetail("SimpleEvictorJob",
                         null,
                         SimpleTTLEvictor.class);
    }
    Trigger trigger;
    try {
      trigger = new CronTrigger("TCEvictionTrigger","TCEvictionGroup",_evictorIntervalTrigger);
    } catch (ParseException e) {
      _LOGGER.info("Could not parse evictor interval trigger expression '"+_evictorIntervalTrigger+"'");
      _LOGGER.info("Falling back on default behavior: Evictor will run every hour");
      trigger = TriggerUtils.makeHourlyTrigger();
      trigger.setName("TCEvictionTrigger");
      trigger.setGroup("TCEvictionGroup");
    }
    trigger.setStartTime(new Date());  // start right now
    trigger.setJobName(jobDetail.getName());
    _sched.scheduleJob(jobDetail, trigger);
    System.out.println("");
  }
}

代码示例来源:origin: opencast/opencast

/**
 * Set the schedule and start or restart the scheduler.
 */
public void schedule() {
 if (quartz == null || schedulerPeriod <= 0) {
  logger.debug("Cancel scheduling of workspace cleaner due to invalid scheduling period");
  return;
 }
 logger.debug("Scheduling workspace cleaner to run every {} seconds.", schedulerPeriod);
 try {
  final Trigger trigger = TriggerUtils.makeSecondlyTrigger(schedulerPeriod);
  trigger.setStartTime(new Date());
  trigger.setName(TRIGGER_NAME);
  trigger.setGroup(TRIGGER_GROUP);
  trigger.setJobName(JOB_NAME);
  trigger.setJobGroup(JOB_GROUP);
  if (quartz.getTriggersOfJob(JOB_NAME, JOB_GROUP).length == 0) {
   quartz.scheduleJob(trigger);
  } else {
   quartz.rescheduleJob(TRIGGER_NAME, TRIGGER_GROUP, trigger);
  }
 } catch (Exception e) {
  logger.error("Error scheduling Quartz job", e);
 }
}

代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1

public Trigger buildTrigger(final JobId jobId, final JobConfig jobConfig)
    throws SchedulerServiceException {
  final byte[] parameters = parameterMapSerializer.serializeParameters(jobConfig.getParameters());
  final Trigger trigger = buildTrigger(jobConfig.getSchedule());
  trigger.setGroup(QUARTZ_TRIGGER_GROUP);
  trigger.setName(jobId.toString());
  trigger.getJobDataMap().put(QUARTZ_PARAMETERS_KEY, parameters);
  return trigger;
}

代码示例来源:origin: org.ikasan/ikasan-framework

recoveryTrigger.setGroup(getTriggerGroup());

代码示例来源:origin: org.ikasan/ikasan-framework

@Override
protected void startInitiator() throws InitiatorOperationException
{
  try
  {
    jobDetail = new JobDetail(INITIATOR_JOB_NAME,getJobGroup(), QuartzStatefulJob.class);
    
    //quartz api requires that first trigger registration needs to use scheduler.scheduleJob(jobDetail,firstTrigger)
    //whilst subsequent trigger registrations for the same job use scheduler.scheduleJob(subsequentTrigger)
    //  - where all subsequentTriggers have the jobName and jobGroup set
    boolean firstTrigger = true;
    for(Trigger trigger: triggers){
      trigger.setGroup(getTriggerGroup());
      if (firstTrigger){
        scheduler.scheduleJob(jobDetail, trigger);
        firstTrigger = false;
      }else{
        trigger.setJobGroup(getJobGroup());
        trigger.setJobName(INITIATOR_JOB_NAME);
        scheduler.scheduleJob(trigger);
      }
    }
    logger.info("Initiator [" + this.getName() + "] started.");
  }
  catch (SchedulerException e)
  {
    throw new InitiatorOperationException("Failed to start Initiator [" + this.getName() + "] [" + "].", e);
  }
}

代码示例来源:origin: org.apache.camel/camel-quartz

public void addTrigger(final Trigger trigger, final JobDetail detail) throws SchedulerException {
  // lets default the trigger name to the job name
  if (trigger.getName() == null) {
    trigger.setName(detail.getName());
  }
  // lets default the trigger group to the job group
  if (trigger.getGroup() == null) {
    trigger.setGroup(detail.getGroup());
  }
  // default start time to now if not specified
  if (trigger.getStartTime() == null) {
    trigger.setStartTime(new Date());
  }
  detail.getJobDataMap().put(QuartzConstants.QUARTZ_ENDPOINT_URI, getEndpointUri());
  if (isUsingFixedCamelContextName()) {
    detail.getJobDataMap().put(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME, getCamelContext().getName());
  } else {
    // must use management name as it should be unique in the same JVM
    detail.getJobDataMap().put(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME, QuartzHelper.getQuartzContextName(getCamelContext()));
  }
  if (detail.getJobClass() == null) {
    detail.setJobClass(isStateful() ? StatefulCamelJob.class : CamelJob.class);
  }
  if (detail.getName() == null) {
    detail.setName(getJobName());
  }
  getComponent().addJob(detail, trigger);
}

代码示例来源:origin: org.rhq/rhq-enterprise-server

trigger.setGroup(jobDetail.getGroup());
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());

代码示例来源:origin: org.rhq/rhq-enterprise-server

trigger.setGroup(jobDetail.getGroup());
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());

相关文章