⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 triggerutils.java

📁 Quartz is a full-featured, open source job scheduling system that can be integrated with, or used al
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * </p>     *       *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeMinutelyTrigger() {        return makeMinutelyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY);    }    /**     * <p>     * Make a trigger that will fire every N minutes, indefinitely.     * </p>     *      * <p>     * The generated trigger will still need to have its name, group,     * start-time and end-time set.     * </p>     *      * @param intervalInMinutes     *          the number of minutes between firings     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeMinutelyTrigger(int intervalInMinutes) {        return makeMinutelyTrigger(intervalInMinutes,                SimpleTrigger.REPEAT_INDEFINITELY);    }    /**     * <p>     * Make a trigger that will fire every N minutes, with the given number of     * repeats.     * </p>     *      * <p>     * The generated trigger will still need to have its name, group,     * start-time and end-time set.     * </p>     *      * @param intervalInMinutes     *          the number of minutes between firings     * @param repeatCount     *          the number of times to repeat the firing     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeMinutelyTrigger(int intervalInMinutes,            int repeatCount) {        SimpleTrigger trig = new SimpleTrigger();        trig.setRepeatInterval(intervalInMinutes * MILLISECONDS_IN_MINUTE);        trig.setRepeatCount(repeatCount);        return trig;    }    /**     * <p>     * Make a trigger that will fire every hour, indefinitely.     * </p>     *      * <p>     * The generated trigger will still need to have its name, group,     * start-time and end-time set.     * </p>     *       *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeHourlyTrigger() {        return makeHourlyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY);    }    /**     * <p>     * Make a trigger that will fire every N hours, indefinitely.     * </p>     *      * <p>     * The generated trigger will still need to have its name, group,     * start-time and end-time set.     * </p>     *      * @param intervalInHours     *          the number of hours between firings     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeHourlyTrigger(int intervalInHours) {        return makeHourlyTrigger(intervalInHours,                SimpleTrigger.REPEAT_INDEFINITELY);    }    /**     * <p>     * Make a trigger that will fire every N hours, with the given number of     * repeats.     * </p>     *      * <p>     * The generated trigger will still need to have its name, group,     * start-time and end-time set.     * </p>     *      * @param intervalInHours     *          the number of hours between firings     * @param repeatCount     *          the number of times to repeat the firing     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Trigger makeHourlyTrigger(int intervalInHours, int repeatCount) {        SimpleTrigger trig = new SimpleTrigger();        trig.setRepeatInterval(intervalInHours * MILLISECONDS_IN_HOUR);        trig.setRepeatCount(repeatCount);        return trig;    }    /**     * <p>     * Returns a date that is rounded to the next even hour above the given     * date.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54 would result in a date     * with the time of 09:00:00. If the date's time is in the 23rd hour, the     * date's 'day' will be promoted, and the time will be set to 00:00:00.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenHourDate(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.setLenient(true);        c.set(Calendar.HOUR_OF_DAY, c.get(Calendar.HOUR_OF_DAY) + 1);        c.set(Calendar.MINUTE, 0);        c.set(Calendar.SECOND, 0);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the previous even hour below the given     * date.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54 would result in a date     * with the time of 08:00:00.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenHourDateBefore(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.set(Calendar.MINUTE, 0);        c.set(Calendar.SECOND, 0);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the next even hour above the given     * date.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54 would result in a date     * with the time of 08:14:00. If the date's time is in the 59th minute,     * then the hour (and possibly the day) will be promoted.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenMinuteDate(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.setLenient(true);        c.set(Calendar.MINUTE, c.get(Calendar.MINUTE) + 1);        c.set(Calendar.SECOND, 0);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the previous even hour below the given     * date.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54 would result in a date     * with the time of 08:13:00.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenMinuteDateBefore(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.set(Calendar.SECOND, 0);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the next even second above the given     * date.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenSecondDate(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.setLenient(true);        c.set(Calendar.SECOND, c.get(Calendar.SECOND) + 1);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the previous even second below the     * given date.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54.341 would result in a     * date with the time of 08:13:00.000.     * </p>     *      * @param date     *          the Date to round, if <code>null</code> the current time will     *          be used     *      * @deprecated use org.quartz.TriggerUtils instead!     *      */    public static Date getEvenSecondDateBefore(Date date) {        if (date == null) {            date = new Date();        }        Calendar c = Calendar.getInstance();        c.setTime(date);        c.set(Calendar.MILLISECOND, 0);        return c.getTime();    }    /**     * <p>     * Returns a date that is rounded to the next even multiple of the given     * minute.     * </p>     *      * <p>     * For example an input date with a time of 08:13:54, and an input     * minute-base of 5 would result in a date with the time of 08:15:00. The     * same input date with an input minute-base of 10 would result in a date     * with the time of 08:20:00. But a date with the time 08:53:31 and an     * input minute-base of 45 would result in 09:00:00, because the even-hour     * is the next 'base' for 45-minute intervals.     * </p>     *      * <p>     * More examples: <table>     * <tr>     * <th>Input Time</th>     * <th>Minute-Base</th>     * <th>Result Time</th>     * </tr>     * <tr>     * <td>11:16:41</td>     * <td>20</td>     * <td>11:20:00</td>     * </tr>     * <tr>     * <td>11:36:41</td>     * <td>20</td>     * <td>11:40:00</td>     * </tr>     * <tr>     * <td>11:46:41</td>     * <td>20</td>     * <td>12:00:00</td>     * </tr>     * <tr>     * <td>11:26:41</td>     * <td>30</td>     * <td>11:30:00</td>     * </tr>     * <tr>     * <td>11:36:41</td>     * <td>30</td>     * <td>12:00:00</td>     * </tr>     * <td>11:16:41</td>     * <td>17</td>     * <td>11:17:00</td>     * </tr>     * </tr>     * <td>11:17:41</td>     * <td>17</td>     * <td>11:34:00</td>     * </tr>     * </tr>     * <td>11:52:41</td>     * <td>17</td>     * <td>12:00:00</td>     * </tr>     * </tr>     * <td>11:52:41</td>     * <td>5</td>     * <td>11:55:00</td>     * </tr>     * </tr>     * <td>11:57:41</td>     * <td>5</td>     * <td>12:00:00</td>     * </tr>     * </tr>     * <td>11:17:41</td>     * <td>0</td>     * <td>12:00:00</td>     * </tr>     * </tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -