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


Java OperableTrigger.clone方法代码示例

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


在下文中一共展示了OperableTrigger.clone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeFireTimes

import org.quartz.spi.OperableTrigger; //导入方法依赖的package包/类
/**
 * Returns a list of Dates that are the next fire times of a 
 * <code>Trigger</code>.
 * The input trigger will be cloned before any work is done, so you need
 * not worry about its state being altered by this method.
 * 
 * @param trigg
 *          The trigger upon which to do the work
 * @param cal
 *          The calendar to apply to the trigger's schedule
 * @param numTimes
 *          The number of next fire times to produce
 * @return List of java.util.Date objects
 */
public static List<Date> computeFireTimes(OperableTrigger trigg, org.quartz.Calendar cal,
        int numTimes) {
    LinkedList<Date> lst = new LinkedList<Date>();

    OperableTrigger t = (OperableTrigger) trigg.clone();

    if (t.getNextFireTime() == null) {
        t.computeFirstFireTime(cal);
    }

    for (int i = 0; i < numTimes; i++) {
        Date d = t.getNextFireTime();
        if (d != null) {
            lst.add(d);
            t.triggered(cal);
        } else {
            break;
        }
    }

    return java.util.Collections.unmodifiableList(lst);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:TriggerUtils.java

示例2: computeFireTimesBetween

import org.quartz.spi.OperableTrigger; //导入方法依赖的package包/类
/**
 * Returns a list of Dates that are the next fire times of a 
 * <code>Trigger</code>
 * that fall within the given date range. The input trigger will be cloned
 * before any work is done, so you need not worry about its state being
 * altered by this method.
 * 
 * <p>
 * NOTE: if this is a trigger that has previously fired within the given
 * date range, then firings which have already occurred will not be listed
 * in the output List.
 * </p>
 * 
 * @param trigg
 *          The trigger upon which to do the work
 * @param cal
 *          The calendar to apply to the trigger's schedule
 * @param from
 *          The starting date at which to find fire times
 * @param to
 *          The ending date at which to stop finding fire times
 * @return List of java.util.Date objects
 */
public static List<Date> computeFireTimesBetween(OperableTrigger trigg,
        org.quartz.Calendar cal, Date from, Date to) {
    LinkedList<Date> lst = new LinkedList<Date>();

    OperableTrigger t = (OperableTrigger) trigg.clone();

    if (t.getNextFireTime() == null) {
        t.setStartTime(from);
        t.setEndTime(to);
        t.computeFirstFireTime(cal);
    }

    while (true) {
        Date d = t.getNextFireTime();
        if (d != null) {
            if (d.before(from)) {
                t.triggered(cal);
                continue;
            }
            if (d.after(to)) {
                break;
            }
            lst.add(d);
            t.triggered(cal);
        } else {
            break;
        }
    }

    return java.util.Collections.unmodifiableList(lst);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:55,代码来源:TriggerUtils.java

示例3: computeFireTimesWithStart

import org.quartz.spi.OperableTrigger; //导入方法依赖的package包/类
public static Date computeFireTimesWithStart(OperableTrigger trigg,org.quartz.Calendar cal, Date from) {
    OperableTrigger t = (OperableTrigger) trigg.clone();
    if (t.getNextFireTime() == null) {
        t.setStartTime(from);
        t.computeFirstFireTime(cal);
    }
    return t.getNextFireTime();
}
 
开发者ID:youseries,项目名称:uflo,代码行数:9,代码来源:TaskNode.java

示例4: storeTrigger

import org.quartz.spi.OperableTrigger; //导入方法依赖的package包/类
/**
 * <p>
 * Store the given <code>{@link org.quartz.Trigger}</code>.
 * </p>
 * 
 * @param newTrigger The <code>Trigger</code> to be stored.
 * @param replaceExisting If <code>true</code>, any <code>Trigger</code> existing in the <code>JobStore</code> with
 *        the same name & group should be over-written.
 * @throws ObjectAlreadyExistsException if a <code>Trigger</code> with the same name/group already exists, and
 *         replaceExisting is set to false.
 * @see #pauseTriggers(org.quartz.impl.matchers.GroupMatcher)
 */
@Override
public void storeTrigger(OperableTrigger newTrigger, boolean replaceExisting) throws JobPersistenceException {
  OperableTrigger clone = (OperableTrigger) newTrigger.clone();

  lock();
  try {
    JobDetail job = retrieveJob(newTrigger.getJobKey());
    if (job == null) {
      //
      throw new JobPersistenceException("The job (" + newTrigger.getJobKey()
                                        + ") referenced by the trigger does not exist.");
    }

    // wrapper construction must be done in lock since serializer is unlocked
    TriggerWrapper tw = wrapperFactory.createTriggerWrapper(clone, job.isConcurrentExectionDisallowed());

    if (triggerFacade.containsKey(tw.getKey())) {
      if (!replaceExisting) { throw new ObjectAlreadyExistsException(newTrigger); }

      removeTrigger(newTrigger.getKey(), false);
    }

    // add to triggers by group
    Set<String> grpSet = toolkitDSHolder.getOrCreateTriggersGroupMap(newTrigger.getKey().getGroup());
    grpSet.add(newTrigger.getKey().getName());
    if (!triggerFacade.hasGroup(newTrigger.getKey().getGroup())) {
      triggerFacade.addGroup(newTrigger.getKey().getGroup());
    }

    if (triggerFacade.pausedGroupsContain(newTrigger.getKey().getGroup())
        || jobFacade.pausedGroupsContain(newTrigger.getJobKey().getGroup())) {
      tw.setState(TriggerState.PAUSED, terracottaClientId, triggerFacade);
      if (jobFacade.blockedJobsContain(tw.getJobKey())) {
        tw.setState(TriggerState.PAUSED_BLOCKED, terracottaClientId, triggerFacade);
      }
    } else if (jobFacade.blockedJobsContain(tw.getJobKey())) {
      tw.setState(TriggerState.BLOCKED, terracottaClientId, triggerFacade);
    } else {
      timeTriggers.add(tw);
    }

    // add to triggers by FQN map
    triggerFacade.put(tw.getKey(), tw);
  } finally {
    unlock();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:60,代码来源:DefaultClusteredJobStore.java

示例5: storeTrigger

import org.quartz.spi.OperableTrigger; //导入方法依赖的package包/类
/**
 * <p>
 * Store the given <code>{@link org.quartz.Trigger}</code>.
 * </p>
 *
 * @param newTrigger
 *          The <code>Trigger</code> to be stored.
 * @param replaceExisting
 *          If <code>true</code>, any <code>Trigger</code> existing in
 *          the <code>JobStore</code> with the same name & group should
 *          be over-written.
 * @throws ObjectAlreadyExistsException
 *           if a <code>Trigger</code> with the same name/group already
 *           exists, and replaceExisting is set to false.
 *
 * @see #pauseTriggers(org.quartz.impl.matchers.GroupMatcher)
 */
public void storeTrigger(OperableTrigger newTrigger,
        boolean replaceExisting) throws JobPersistenceException {
    TriggerWrapper tw = new TriggerWrapper((OperableTrigger)newTrigger.clone());

    synchronized (lock) {
        if (triggersByKey.get(tw.key) != null) {
            if (!replaceExisting) {
                throw new ObjectAlreadyExistsException(newTrigger);
            }

            removeTrigger(newTrigger.getKey(), false);
        }

        if (retrieveJob(newTrigger.getJobKey()) == null) {
            throw new JobPersistenceException("The job ("
                    + newTrigger.getJobKey()
                    + ") referenced by the trigger does not exist.");
        }

        // add to triggers array
        triggers.add(tw);
        // add to triggers by group
        HashMap<TriggerKey, TriggerWrapper> grpMap = triggersByGroup.get(newTrigger.getKey().getGroup());
        if (grpMap == null) {
            grpMap = new HashMap<TriggerKey, TriggerWrapper>(100);
            triggersByGroup.put(newTrigger.getKey().getGroup(), grpMap);
        }
        grpMap.put(newTrigger.getKey(), tw);
        // add to triggers by FQN map
        triggersByKey.put(tw.key, tw);

        if (pausedTriggerGroups.contains(newTrigger.getKey().getGroup())
                || pausedJobGroups.contains(newTrigger.getJobKey().getGroup())) {
            tw.state = TriggerWrapper.STATE_PAUSED;
            if (blockedJobs.contains(tw.jobKey)) {
                tw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
            }
        } else if (blockedJobs.contains(tw.jobKey)) {
            tw.state = TriggerWrapper.STATE_BLOCKED;
        } else {
            timeTriggers.add(tw);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:62,代码来源:RAMJobStore.java


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