Index: 3rdParty_sources/versions.txt =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/versions.txt,v diff -u -r1.11.2.11 -r1.11.2.12 --- 3rdParty_sources/versions.txt 25 Nov 2014 10:47:02 -0000 1.11.2.11 +++ 3rdParty_sources/versions.txt 15 Dec 2014 10:09:55 -0000 1.11.2.12 @@ -38,7 +38,7 @@ openws 1.5.0 -Quartz 1.5.2 +Quartz 2.2.1 Servlet API 3.1 Index: 3rdParty_sources/quartz/org/quartz/Calendar.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/Calendar.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/Calendar.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/Calendar.java 15 Dec 2014 10:09:46 -0000 1.1.2.1 @@ -1,6 +1,6 @@ /* - * Copyright 2004-2005 OpenSymphony + * Copyright 2001-2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -16,24 +16,29 @@ * */ -/* - * Previously Copyright (c) 2001-2004 James House - */ - - package org.quartz; /** - *
- * An interface to be implemented by objects that define spaces of time that
- * should be included or excluded from a {@link Trigger}'s
- * normal 'firing' schedule.
- *
{@link Trigger} may (not) fire. Calendars
+ * do not define actual fire times, but rather are used to limit a
+ * Trigger from firing on its normal schedule if necessary. Most
+ * Calendars include all times by default and allow the user to specify times
+ * to exclude.
*
+ * As such, it is often useful to think of Calendars as being used to exclude a block
+ * of time - as opposed to include a block of time. (i.e. the
+ * schedule "fire every five minutes except on Sundays" could be
+ * implemented with a SimpleTrigger and a
+ * WeeklyCalendar which excludes Sundays)
Implementations MUST take care of being properly Cloneable
+ * and Serializable.
* Get the base calendar. Will be null, if not set. *
*/ - public Calendar getBaseCalendar(); + Calendar getBaseCalendar(); /** ** Determine whether the given time (in milliseconds) is 'included' by the * Calendar. *
*/ - public boolean isTimeIncluded(long timeStamp); + boolean isTimeIncluded(long timeStamp); /** ** Determine the next time (in milliseconds) that is 'included' by the * Calendar after the given time. *
*/ - public long getNextIncludedTime(long timeStamp); + long getNextIncludedTime(long timeStamp); /** *@@ -91,7 +96,7 @@ * * @return null if no description was set. */ - public String getDescription(); + String getDescription(); /** *
@@ -100,5 +105,7 @@ * the description has no meaning to Quartz. *
*/ - public void setDescription(String description); + void setDescription(String description); + + Object clone(); } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/CalendarIntervalScheduleBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/CalendarIntervalTrigger.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/CriticalSchedulerException.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/quartz/org/quartz/CronExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/CronExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/CronExpression.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/CronExpression.java 15 Dec 2014 10:09:46 -0000 1.1.2.1 @@ -1,3 +1,20 @@ +/* + * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + */ + package org.quartz; import java.io.Serializable; @@ -56,7 +73,7 @@ *1-31, - * ? / L W C, - * ? / L WMonthYear (Optional)empty, 1970-2099empty, 1970-2199, - * /* The '?' character is allowed for the day-of-month and day-of-week fields. It * is used to specify 'no specific value'. This is useful when you need to - * specify something in one of the two fileds, but not the other. + * specify something in one of the two fields, but not the other. *
* The '-' character is used to specify ranges For example "10-12" in * the hour field means "the hours 10, 11 and 12". @@ -115,9 +132,10 @@ * day-of-week field by itself, it simply means "7" or * "SAT". But if used in the day-of-week field after another value, it * means "the last xxx day of the month" - for example "6L" - * means "the last friday of the month". When using the 'L' option, it - * is important not to specify lists, or ranges of values, as you'll get - * confusing results. + * means "the last friday of the month". You can also specify an offset + * from the last day of the month, such as "L-3" which would mean the third-to-last + * day of the calendar month. When using the 'L' option, it is important not to + * specify lists, or ranges of values, as you'll get confusing/unexpected results. *
* The 'W' character is allowed for the day-of-month field. This character * is used to specify the weekday (Monday-Friday) nearest the given day. As an @@ -142,15 +160,17 @@ * Other examples: "2#1" = the first Monday of the month and * "4#5" = the fifth Wednesday of the month. Note that if you specify * "#5" and there is not 5 of the given day-of-week in the month, then - * no firing will occur that month. + * no firing will occur that month. If the '#' character is used, there can + * only be one expression in the day-of-week field ("3#1,6#3" is + * not valid, since there are two expressions). *
* + * means "the first day included by the calendar on or after Sunday".--> *
* The legal characters and the names of months and days of the week are not * case sensitive. @@ -159,8 +179,15 @@ * NOTES: *
CronExpression based on the specified
- * parameter.
- *
- * @param cronExpression String representation of the cron expression the
- * new object should represent
- * @throws java.text.ParseException
- * if the string expression cannot be parsed into a valid
- * CronExpression
- */
- public CronExpression(String cronExpression) throws ParseException {
- if (cronExpression == null) {
- throw new IllegalArgumentException("cronExpression cannot be null");
- }
-
- this.cronExpression = cronExpression;
-
- buildExpression(cronExpression.toUpperCase(Locale.US));
- }
-
- /**
- * Indicates whether the given date satisfies the cron expression. Note that
- * milliseconds are ignored, so two Dates falling on different milliseconds
- * of the same second will always have the same result here.
- *
- * @param date the date to evaluate
- * @return a boolean indicating whether the given date satisfies the cron
- * expression
- */
- public boolean isSatisfiedBy(Date date) {
- Calendar testDateCal = Calendar.getInstance();
- testDateCal.setTime(date);
- testDateCal.set(Calendar.MILLISECOND, 0);
- Date originalDate = testDateCal.getTime();
-
- testDateCal.add(Calendar.SECOND, -1);
-
- if (getTimeAfter(testDateCal.getTime()).equals(originalDate)) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Returns the next date/time after the given date/time which
- * satisfies the cron expression.
- *
- * @param date the date/time at which to begin the search for the next valid
- * date/time
- * @return the next valid date/time
- */
- public Date getNextValidTimeAfter(Date date) {
- return getTimeAfter(date);
- }
-
+ * Constructs a new CronExpression based on the specified
+ * parameter.
+ *
+ * @param cronExpression String representation of the cron expression the
+ * new object should represent
+ * @throws java.text.ParseException
+ * if the string expression cannot be parsed into a valid
+ * CronExpression
+ */
+ public CronExpression(String cronExpression) throws ParseException {
+ if (cronExpression == null) {
+ throw new IllegalArgumentException("cronExpression cannot be null");
+ }
+
+ this.cronExpression = cronExpression.toUpperCase(Locale.US);
+
+ buildExpression(this.cronExpression);
+ }
+
/**
- *
- * Returns the time zone for which the cronExpression of
- * this CronTrigger will be resolved.
- *
CronExpression
+ * will be resolved.
+ */
public TimeZone getTimeZone() {
- if (timeZone == null) timeZone = TimeZone.getDefault();
+ if (timeZone == null) {
+ timeZone = TimeZone.getDefault();
+ }
return timeZone;
}
/**
- *
- * Sets the time zone for which the cronExpression of this
- * CronTrigger will be resolved.
- *
CronExpression
+ * will be resolved.
*/
public void setTimeZone(TimeZone timeZone) {
this.timeZone = timeZone;
}
-
- /**
- * Returns the string representation of the CronExpression
- *
- * @return a string representation of the CronExpression
- */
- public String toString() {
- return cronExpression;
- }
-
- /**
- * Indicates whether the specified cron expression can be parsed into a
- * valid cron expression
- *
- * @param cronExpression the expression to evaluate
- * @return a boolean indicating whether the given expression is a valid cron
- * expression
- */
- public static boolean isValidExpression(String cronExpression) {
-
- try {
- new CronExpression(cronExpression);
- } catch (ParseException pe) {
- return false;
- }
-
- return true;
- }
-
+
+ /**
+ * Returns the string representation of the CronExpression
+ *
+ * @return a string representation of the CronExpression
+ */
+ @Override
+ public String toString() {
+ return cronExpression;
+ }
+
+ /**
+ * Indicates whether the specified cron expression can be parsed into a
+ * valid cron expression
+ *
+ * @param cronExpression the expression to evaluate
+ * @return a boolean indicating whether the given expression is a valid cron
+ * expression
+ */
+ public static boolean isValidExpression(String cronExpression) {
+
+ try {
+ new CronExpression(cronExpression);
+ } catch (ParseException pe) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static void validateExpression(String cronExpression) throws ParseException {
+
+ new CronExpression(cronExpression);
+ }
+
+
////////////////////////////////////////////////////////////////////////////
//
// Expression Parsing Functions
@@ -345,13 +439,27 @@
try {
- if (seconds == null) seconds = new TreeSet();
- if (minutes == null) minutes = new TreeSet();
- if (hours == null) hours = new TreeSet();
- if (daysOfMonth == null) daysOfMonth = new TreeSet();
- if (months == null) months = new TreeSet();
- if (daysOfWeek == null) daysOfWeek = new TreeSet();
- if (years == null) years = new TreeSet();
+ if (seconds == null) {
+ seconds = new TreeSetCronExpression matches.
+ */
+ public Date getTimeBefore(Date endTime) {
+ // FUTURE_TODO: implement QUARTZ-423
return null;
}
+ /**
+ * NOT YET IMPLEMENTED: Returns the final time that the
+ * CronExpression will match.
+ */
+ public Date getFinalFireTime() {
+ // FUTURE_TODO: implement QUARTZ-423
+ return null;
+ }
+
protected boolean isLeapYear(int year) {
- if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) return true;
- else
- return false;
+ return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
}
protected int getLastDayOfMonth(int monthNum, int year) {
switch (monthNum) {
- case 1:
- return 31;
- case 2:
- return (isLeapYear(year)) ? 29 : 28;
- case 3:
- return 31;
- case 4:
- return 30;
- case 5:
- return 31;
- case 6:
- return 30;
- case 7:
- return 31;
- case 8:
- return 31;
- case 9:
- return 30;
- case 10:
- return 31;
- case 11:
- return 30;
- case 12:
- return 31;
- default:
- throw new IllegalArgumentException("Illegal month number: "
- + monthNum);
+ case 1:
+ return 31;
+ case 2:
+ return (isLeapYear(year)) ? 29 : 28;
+ case 3:
+ return 31;
+ case 4:
+ return 30;
+ case 5:
+ return 31;
+ case 6:
+ return 30;
+ case 7:
+ return 31;
+ case 8:
+ return 31;
+ case 9:
+ return 30;
+ case 10:
+ return 31;
+ case 11:
+ return 30;
+ case 12:
+ return 31;
+ default:
+ throw new IllegalArgumentException("Illegal month number: "
+ + monthNum);
}
}
private void readObject(java.io.ObjectInputStream stream)
- throws java.io.IOException, ClassNotFoundException {
+ throws java.io.IOException, ClassNotFoundException {
+
stream.defaultReadObject();
try {
buildExpression(cronExpression);
} catch (Exception ignore) {
} // never happens
}
+ @Override
+ @Deprecated
public Object clone() {
- CronExpression copy = null;
- try {
- copy = new CronExpression(getCronExpression());
- copy.setTimeZone(getTimeZone());
- } catch (ParseException ex) { // never happens since the source is valid...
- throw new IncompatibleClassChangeError("Not Cloneable.");
- }
- return copy;
- }
+ return new CronExpression(this);
+ }
}
class ValueSet {
public int value;
public int pos;
-}
\ No newline at end of file
+}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/CronScheduleBuilder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/quartz/org/quartz/CronTrigger.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/CronTrigger.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/CronTrigger.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/CronTrigger.java 15 Dec 2014 10:09:47 -0000 1.1.2.1
@@ -1,5 +1,5 @@
-/*
- * Copyright 2004-2005 OpenSymphony
+/*
+ * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -15,22 +15,15 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
-import java.text.ParseException;
import java.util.Calendar;
-import java.util.Date;
import java.util.TimeZone;
-
/**
- *
- * A concrete {@link Trigger} that is used to fire a {@link org.quartz.JobDetail}
- * at given moments in time, defined with Unix 'cron-like' definitions.
- *
{@link org.quartz.Job}
+ * at given moments in time, defined with Unix 'cron-like' schedule definitions.
*
* * For those unfamiliar with "cron", this means being able to create a firing @@ -139,7 +132,7 @@ *
"0 15 10 ? * 6L 2002-2005"Fire at 10:15am on every last friday of every month during the years 2002, 2003, 2004 and 2005
+ * Fire at 10:15am on every last Friday of every month during the years 2002, 2003, 2004 and 2005
*
* Instructs the {@link Scheduler} that upon a mis-fire
@@ -193,7 +179,7 @@
*
* Instructs the {@link Scheduler} that upon a mis-fire
@@ -205,765 +191,17 @@
*/
public static final int MISFIRE_INSTRUCTION_DO_NOTHING = 2;
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Data members.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
+ public String getCronExpression();
- private CronExpression cronEx = null;
- private Date startTime = null;
- private Date endTime = null;
- private Date nextFireTime = null;
- private Date previousFireTime = null;
- private transient TimeZone timeZone = null;
-
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Constructors.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
/**
*
- * Create a CronTrigger with no settings.
- *
- * The start-time will also be set to the current time, and the time zone - * will be set the the system's default time zone. - *
- */ - public CronTrigger() { - super(); - setStartTime(new Date()); - setTimeZone(TimeZone.getDefault()); - } - - /** - *
- * Create a CronTrigger with the given name and group.
- *
- * The start-time will also be set to the current time, and the time zone - * will be set the the system's default time zone. - *
- */ - public CronTrigger(String name, String group) { - super(name, group); - setStartTime(new Date()); - setTimeZone(TimeZone.getDefault()); - } - - /** - *
- * Create a CronTrigger with the given name, group and
- * expression.
- *
- * The start-time will also be set to the current time, and the time zone - * will be set the the system's default time zone. - *
- */ - public CronTrigger(String name, String group, String cronExpression) - throws ParseException { - super(name, group); - - setCronExpression(cronExpression); - - setStartTime(new Date()); - setTimeZone(TimeZone.getDefault()); - } - - /** - *
- * Create a CronTrigger with the given name and group, and
- * associated with the identified {@link org.quartz.JobDetail}.
- *
- * The start-time will also be set to the current time, and the time zone - * will be set the the system's default time zone. - *
- */ - public CronTrigger(String name, String group, String jobName, - String jobGroup) { - super(name, group, jobName, jobGroup); - setStartTime(new Date()); - setTimeZone(TimeZone.getDefault()); - } - - /** - *
- * Create a CronTrigger with the given name and group,
- * associated with the identified {@link org.quartz.JobDetail},
- * and with the given "cron" expression.
- *
- * The start-time will also be set to the current time, and the time zone - * will be set the the system's default time zone. - *
- */ - public CronTrigger(String name, String group, String jobName, - String jobGroup, String cronExpression) throws ParseException { - this(name, group, jobName, jobGroup, null, null, cronExpression, - TimeZone.getDefault()); - } - - /** - *
- * Create a CronTrigger with the given name and group,
- * associated with the identified {@link org.quartz.JobDetail},
- * and with the given "cron" expression resolved with respect to the TimeZone.
- *
- * Create a CronTrigger that will occur at the given time,
- * until the given end time.
- *
- * If null, the start-time will also be set to the current time, the time - * zone will be set the the system's default. - *
- * - * @param startTime - * ADate set to the time for the Trigger
- * to fire.
- * @param endTime
- * A Date set to the time for the Trigger
- * to quit repeat firing.
- */
- public CronTrigger(String name, String group, String jobName,
- String jobGroup, Date startTime, Date endTime, String cronExpression)
- throws ParseException {
- super(name, group, jobName, jobGroup);
-
- setCronExpression(cronExpression);
-
- if (startTime == null) startTime = new Date();
- setStartTime(startTime);
- if (endTime != null) setEndTime(endTime);
- setTimeZone(TimeZone.getDefault());
-
- }
-
- /**
- *
- * Create a CronTrigger with fire time dictated by the
- * cronExpression resolved with respect to the specified
- * timeZone occuring from the startTime until
- * the given endTime.
- *
- * If null, the start-time will also be set to the current time. If null, - * the time zone will be set to the system's default. - *
- * - * @param name - * of theTrigger
- * @param group
- * of the Trigger
- * @param jobName,
- * name of the {@link org.quartz.JobDetail}
- * executed on firetime
- * @param jobGroup,
- * group of the {@link org.quartz.JobDetail}
- * executed on firetime
- * @param startTime
- * A Date set to the earliest time for the Trigger
- * to start firing.
- * @param endTime
- * A Date set to the time for the Trigger
- * to quit repeat firing.
- * @param cronExpression,
- * A cron expression dictating the firing sequence of the Trigger
- * @param timeZone,
- * Specifies for which time zone the cronExpression
- * should be interprted, i.e. the expression 0 0 10 * * ?, is
- * resolved to 10:00 am in this time zone.
- * @throws ParseException
- * if the cronExpression is invalid.
- */
- public CronTrigger(String name, String group, String jobName,
- String jobGroup, Date startTime, Date endTime,
- String cronExpression, TimeZone timeZone) throws ParseException {
- super(name, group, jobName, jobGroup);
-
- setCronExpression(cronExpression);
-
- if (startTime == null) startTime = new Date();
- setStartTime(startTime);
- if (endTime != null) setEndTime(endTime);
- if (timeZone == null) {
- setTimeZone(TimeZone.getDefault());
- } else {
- setTimeZone(timeZone);
- }
- }
-
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Interface.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
- public Object clone() {
- CronTrigger copy = (CronTrigger) super.clone();
- copy.setCronExpression((CronExpression)cronEx.clone());
- return copy;
- }
-
- public void setCronExpression(String cronExpression) throws ParseException {
- this.cronEx = new CronExpression(cronExpression);
- this.cronEx.setTimeZone(getTimeZone());
- }
-
- public String getCronExpression() {
- return cronEx == null ? null : cronEx.getCronExpression();
- }
-
- public void setCronExpression(CronExpression cronExpression) {
- this.cronEx = cronExpression;
- this.timeZone = cronExpression.getTimeZone();
- }
-
- /**
- *
- * Get the time at which the CronTrigger should occur.
- *
- * Get the time at which the CronTrigger should quit
- * repeating - even if repeastCount isn't yet satisfied.
- *
- * Returns the next time at which the CronTrigger will fire.
- * If the trigger will not fire again, null will be
- * returned. The value returned is not guaranteed to be valid until after
- * the Trigger has been added to the scheduler.
- *
- * Returns the previous time at which the CronTrigger will
- * fire. If the trigger has not yet fired, null will be
- * returned.
- */
- public Date getPreviousFireTime() {
- return this.previousFireTime;
- }
-
- /**
- *
- * Sets the next time at which the CronTrigger will fire.
- * This method should not be invoked by client code.
- *
- * Set the previous time at which the SimpleTrigger fired.
- *
- * This method should not be invoked by client code. - *
- */ - public void setPreviousFireTime(Date previousFireTime) { - this.previousFireTime = previousFireTime; - } - - /** - *
* Returns the time zone for which the cronExpression of
* this CronTrigger will be resolved.
*
- * Sets the time zone for which the cronExpression of this
- * CronTrigger will be resolved.
- *
- * Returns the next time at which the CronTrigger will fire,
- * after the given time. If the trigger will not fire after the given time,
- * null will be returned.
- *
- * Note that the date returned is NOT validated against the related - * org.quartz.Calendar (if any) - *
- */ - public Date getFireTimeAfter(Date afterTime) { - if (afterTime == null) afterTime = new Date(); - - if (startTime.after(afterTime)) - afterTime = new Date(startTime.getTime() - 1000l); - - Date pot = getTimeAfter(afterTime); - if (endTime != null && pot != null && pot.after(endTime)) return null; - - return pot; - } - - /** - *
- * Returns the final time at which the CronTrigger will
- * fire.
- *
- * Note that the return time *may* be in the past. and the date returned is - * not validated against org.quartz.calendar - *
- */ - public Date getFinalFireTime() { - if (this.endTime != null) return getTimeBefore(this.endTime); - else - return null; - } - - /** - *
- * Determines whether or not the CronTrigger will occur
- * again.
- *
- * Updates the CronTrigger's state based on the
- * MISFIRE_INSTRUCTION_XXX that was selected when the SimpleTrigger
- * was created.
- *
- * If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY,
- * then the following scheme will be used:
- *
MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
- * - * Determines whether the date and (optionally) time of the given Calendar - * instance falls on a scheduled fire-time of this trigger. - *
- * - *
- * Equivalent to calling willFireOn(cal, false).
- *
- * Determines whether the date and (optionally) time of the given Calendar - * instance falls on a scheduled fire-time of this trigger. - *
- * - *- * Note that the value returned is NOT validated against the related - * org.quartz.Calendar (if any) - *
- * - * @param test the date to compare - * @param dayOnly if set to true, the method will only determine if the - * trigger will fire during the day represented by the given Calendar - * (hours, minutes and seconds will be ignored). - * @see #willFireOn(Calendar) - */ - public boolean willFireOn(Calendar test, boolean dayOnly) { - - test = (Calendar) test.clone(); - - test.set(Calendar.MILLISECOND, 0); // don't compare millis. - - if(dayOnly) { - test.set(Calendar.HOUR, 0); - test.set(Calendar.MINUTE, 0); - test.set(Calendar.SECOND, 0); - } - - Date testTime = test.getTime(); - - Date fta = getFireTimeAfter(new Date(test.getTime().getTime() - 1000)); - - Calendar p = Calendar.getInstance(test.getTimeZone()); - p.setTime(fta); - - int year = p.get(Calendar.YEAR); - int month = p.get(Calendar.MONTH); - int day = p.get(Calendar.DATE); - - if(dayOnly) { - return (year == test.get(Calendar.YEAR) - && month == test.get(Calendar.MONTH) - && day == test.get(Calendar.DATE)); - } - - while(fta.before(testTime)) { - fta = getFireTimeAfter(fta); - } - - if(fta.equals(testTime)) - return true; - - return false; - } - - /** - *
- * Called after the {@link Scheduler} has executed the
- * {@link org.quartz.JobDetail} associated with the Trigger
- * in order to get the final instruction code from the trigger.
- *
JobExecutionContext that was used by the
- * Job'sexecute(xx) method.
- * @param result
- * is the JobExecutionException thrown by the
- * Job, if any (may be null).
- * @return one of the Trigger.INSTRUCTION_XXX constants.
- *
- * @see #INSTRUCTION_NOOP
- * @see #INSTRUCTION_RE_EXECUTE_JOB
- * @see #INSTRUCTION_DELETE_TRIGGER
- * @see #INSTRUCTION_SET_TRIGGER_COMPLETE
- * @see #triggered(Calendar)
- */
- public int executionComplete(JobExecutionContext context,
- JobExecutionException result) {
- if (result != null && result.refireImmediately())
- return INSTRUCTION_RE_EXECUTE_JOB;
-
- if (result != null && result.unscheduleFiringTrigger())
- return INSTRUCTION_SET_TRIGGER_COMPLETE;
-
- if (result != null && result.unscheduleAllTriggers())
- return INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE;
-
- if (!mayFireAgain()) return INSTRUCTION_DELETE_TRIGGER;
-
- return INSTRUCTION_NOOP;
- }
-
- /**
- *
- * Called when the {@link Scheduler} has decided to 'fire'
- * the trigger (execute the associated Job), in order to
- * give the Trigger a chance to update itself for its next
- * triggering (if any).
- *
- * Called by the scheduler at the time a Trigger is first
- * added to the scheduler, in order to have the Trigger
- * compute its first fire time, based on any associated calendar.
- *
- * After this method has been called, getNextFireTime()
- * should return a valid answer.
- *
Trigger will be fired
- * by the scheduler, which is also the same value getNextFireTime()
- * will return (until after the first firing of the Trigger).
- *
- */
- public Date computeFirstFireTime(org.quartz.Calendar calendar) {
- nextFireTime = getFireTimeAfter(new Date(startTime.getTime() - 1000l));
-
- while (nextFireTime != null && calendar != null
- && !calendar.isTimeIncluded(nextFireTime.getTime())) {
- nextFireTime = getFireTimeAfter(nextFireTime);
- }
-
- return nextFireTime;
- }
-
- public String getExpressionSummary() {
- return cronEx == null ? null : cronEx.getExpressionSummary();
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Computation Functions
- //
- ////////////////////////////////////////////////////////////////////////////
-
- protected Date getTimeAfter(Date afterTime) {
- return cronEx.getTimeAfter(afterTime);
- }
-
- protected Date getTimeBefore(Date endTime)
- {
- return null;
- }
-
- public static void main(String[] args) // TODO: remove method after good
- // unit testing
- throws Exception {
-
- String expr = "15 10 0/4 * * ?";
- if(args != null && args.length > 0 && args[0] != null)
- expr = args[0];
-
- CronTrigger ct = new CronTrigger("t", "g", "j", "g", new Date(), null, expr);
- ct.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
- System.err.println(ct.getExpressionSummary());
- System.err.println("tz=" + ct.getTimeZone().getID());
- System.err.println();
-
- java.util.List times = TriggerUtils.computeFireTimes(ct, null, 25);
-
- for (int i = 0; i < times.size(); i++) {
- System.err.println("firetime = " + times.get(i));
- }
-
- Calendar tt = Calendar.getInstance();
- tt.set(Calendar.DATE, 17);
- tt.set(Calendar.MONTH, 5 - 1);
- tt.set(Calendar.HOUR, 11);
- tt.set(Calendar.MINUTE, 0);
- tt.set(Calendar.SECOND, 7);
-
- System.err.println("\nWill fire on: " + tt.getTime() + " -- " + ct.willFireOn(tt, false));
-
-
-// CRON Expression: 0 0 9 * * ?
-//
-// TimeZone.getDefault().getDisplayName() = Central African Time
-// TimeZone.getDefault().getID() = Africa/Harare
- //
-//// System.err.println();
-//// System.err.println();
-//// System.err.println();
-//// System.err.println("Daylight test:");
-////
-//// CronTrigger trigger = new CronTrigger();
-////
-//// TimeZone timeZone = TimeZone.getTimeZone("America/Los_Angeles");
-//// // TimeZone timeZone = TimeZone.getDefault();
-////
-//// trigger.setTimeZone(timeZone);
-//// trigger.setCronExpression("0 0 1 ? 4 *");
-////
-//// Date start = new Date(1056319200000L);
-//// Date end = new Date(1087682399000L);
-////
-//// trigger.setStartTime(start);
-//// trigger.setEndTime(end);
-////
-//// Date next = new Date(1056232800000L);
-//// while (next != null) {
-//// next = trigger.getFireTimeAfter(next);
-//// if (next != null) {
-//// Calendar cal = Calendar.getInstance();
-//// cal.setTimeZone(timeZone);
-//// cal.setTime(next);
-//// System.err.println(cal.get(Calendar.MONTH) + "/"
-//// + cal.get(Calendar.DATE) + "/" + cal.get(Calendar.YEAR)
-//// + " - " + cal.get(Calendar.HOUR_OF_DAY) + ":"
-//// + cal.get(Calendar.MINUTE));
-//// }
-//// }
-////
-//// System.err.println();
-//// System.err.println();
-//// System.err.println();
-//// System.err.println("Midnight test:");
-////
-//// trigger = new CronTrigger();
-////
-//// timeZone = TimeZone.getTimeZone("Asia/Jerusalem");
-//// // timeZone = TimeZone.getTimeZone("America/Los_Angeles");
-//// // TimeZone timeZone = TimeZone.getDefault();
-////
-//// trigger.setTimeZone(timeZone);
-//// trigger.setCronExpression("0 /15 * ? 4 *");
-////
-//// start = new Date(1056319200000L);
-//// end = new Date(1087682399000L);
-////
-//// trigger.setStartTime(start);
-//// trigger.setEndTime(end);
-////
-//// next = new Date(1056232800000L);
-//// while (next != null) {
-//// next = trigger.getFireTimeAfter(next);
-//// if (next != null) {
-//// Calendar cal = Calendar.getInstance();
-//// cal.setTimeZone(timeZone);
-//// cal.setTime(next);
-//// System.err.println(cal.get(Calendar.MONTH) + "/"
-//// + cal.get(Calendar.DATE) + "/" + cal.get(Calendar.YEAR)
-//// + " - " + cal.get(Calendar.HOUR_OF_DAY) + ":"
-//// + cal.get(Calendar.MINUTE));
-//// }
-//// }
-
- }
+ TriggerBuilder
* The interface to be implemented by {@link Job}s that provide a
- * mechanism for having their execution interrupted. It is NOT a requirment
+ * mechanism for having their execution interrupted. It is NOT a requirement
* for jobs to implement this interface - in fact, for most people, none of
* their jobs will.
- *
Interrupting a Job is very analogous in concept and
+ * challenge to normal interruption of a Thread in Java.
+ *
*
* The means of actually interrupting the Job must be implemented within the
* Job itself (the interrupt() method of this
@@ -51,18 +49,22 @@
* If the Job performs some form of blocking I/O or similar functions, you may
* want to consider having the Job.execute(..) method store a
* reference to the calling Thread as a member variable. Then the
- * impplementation of this interfaces interrupt() method can call
+ * Implementation of this interfaces interrupt() method can call
* interrupt() on that Thread. Before attempting this, make
* sure that you fully understand what java.lang.Thread.interrupt()
* does and doesn't do. Also make sure that you clear the Job's member
- * reference to the Thread when the execute(..) method exits (preferrably in a
+ * reference to the Thread when the execute(..) method exits (preferably in a
* finally block.
*
+ * See Example 7 (org.quartz.examples.example7.DumbInterruptableJob) for a simple + * implementation demonstration. + *
* @see Job * @see StatefulJob - * @see Scheduler#interrupt(String, String) - * @see org.quartz.examples.example7.DumbInterruptableJob + * @see Scheduler#interrupt(JobKey) + * @see Scheduler#interrupt(String) * * @author James House */ @@ -82,12 +84,9 @@ * interrupts theJob.
*
*
- * @return void (nothing) if job interrupt is successful.
* @throws UnableToInterruptJobException
* if there is an exception while interrupting the job.
*/
- public void interrupt()
- throws UnableToInterruptJobException;
-
-
+ void interrupt()
+ throws UnableToInterruptJobException;
}
Index: 3rdParty_sources/quartz/org/quartz/Job.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/Job.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/Job.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/Job.java 15 Dec 2014 10:09:47 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,9 +16,6 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
/**
@@ -38,7 +35,10 @@
*
*
* @see JobDetail
- * @see StatefulJob
+ * @see JobBuilder
+ * @see ExecuteInJTATransaction
+ * @see DisallowConcurrentExecution
+ * @see PersistJobDataAfterExecution
* @see Trigger
* @see Scheduler
*
@@ -70,11 +70,10 @@
* execution.
*
*
- * @return void (nothing) if job is successful.
* @throws JobExecutionException
* if there is an exception while executing the job.
*/
- public void execute(JobExecutionContext context)
- throws JobExecutionException;
+ void execute(JobExecutionContext context)
+ throws JobExecutionException;
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/JobBuilder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/quartz/org/quartz/JobDataMap.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/JobDataMap.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/JobDataMap.java 17 Aug 2012 15:10:18 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/JobDataMap.java 15 Dec 2014 10:09:47 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,26 +16,20 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
import java.io.Serializable;
-import java.util.Iterator;
import java.util.Map;
-import org.quartz.utils.DirtyFlagMap;
+import org.quartz.utils.StringKeyDirtyFlagMap;
/**
- *
* Holds state information for Job instances.
- *
* JobDataMap instances are stored once when the Job
* is added to a scheduler. They are also re-persisted after every execution of
- * StatefulJob instances.
+ * jobs annotated with @PersistJobDataAfterExecution.
*
@@ -54,13 +48,13 @@ *
* * @see Job - * @see StatefulJob + * @see PersistJobDataAfterExecution * @see Trigger * @see JobExecutionContext * * @author James House */ -public class JobDataMap extends DirtyFlagMap implements Serializable { +public class JobDataMap extends StringKeyDirtyFlagMap implements Serializable { private static final long serialVersionUID = -6939901990106713909L; @@ -72,16 +66,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - private boolean allowsTransientData = false; - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Constructors. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - /** *
* Create an empty JobDataMap.
@@ -96,10 +80,11 @@
* Create a JobDataMap with the given data.
*
- * Tell the JobDataMap that it should allow non- Serializable
- * data.
- *
- * If the JobDataMap does contain non- Serializable
- * objects, and it belongs to a non-volatile Job that is
- * stored in a JobStore that supports persistence, then
- * those elements will be nulled-out during persistence.
- *
- * Nulls-out any data values that are non-Serializable. - *
- */ - public void removeTransientData() { - - if (!getAllowsTransientData()) // short circuit... - return; - - String[] keys = getKeys(); - - for (int i = 0; i < keys.length; i++) { - Object o = super.get(keys[i]); - if (!(o instanceof Serializable)) remove(keys[i]); - } - - } - - /** - *
- * Adds the name-value pairs in the given Map to the JobDataMap.
- *
- * All keys must be Strings, and all values must be Serializable.
- *
- * Adds the given int value to the Job's
- * data map.
- *
- * Adds the given long value to the Job's
- * data map.
- *
- * Adds the given float value to the Job's
- * data map.
- *
- * Adds the given double value to the Job's
- * data map.
- *
- * Adds the given boolean value to the Job's
- * data map.
- *
- * Adds the given char value to the Job's
- * data map.
- *
- * Adds the given String value to the Job's
- * data map.
- *
* Adds the given boolean value as a string version to the
* Job's data map.
*
- * Adds the given Serializable object value to the JobDataMap.
- *
* Retrieve the identified int value from the JobDataMap.
*
- * Retrieve the identified long value from the JobDataMap.
- *
- * Retrieve the identified float value from the JobDataMap.
- *
- * Retrieve the identified double value from the JobDataMap.
- *
- * Retrieve the identified boolean value from the JobDataMap.
- *
- * Retrieve the identified char value from the JobDataMap.
- *
- * Retrieve the identified String value from the JobDataMap.
- *
- * Retrieve the identified int value from the JobDataMap.
- *
- * Conveys the detail properties of a given Job instance.
- *
Job instance. JobDetails are
+ * to be created/defined with {@link JobBuilder}.
*
*
* Quartz does not store an actual instance of a Job class, but
* instead allows you to define an instance of one, through the use of a JobDetail.
*
- * Job s have a name and group associated with them, which
+ * Jobs have a name and group associated with them, which
* should uniquely identify them within a single {@link Scheduler}.
*
- * Trigger s are the 'mechanism' by which Job s
- * are scheduled. Many Trigger s can point to the same Job,
+ * Triggers are the 'mechanism' by which Jobs
+ * are scheduled. Many Triggers can point to the same Job,
* but a single Trigger can only point to one Job.
*
- * Create a JobDetail with no specified name or group, and
- * the default settings of all the other properties.
- *
- * Note that the {@link #setName(String)},{@link #setGroup(String)}and - * {@link #setJobClass(Class)}methods must be called before the job can be - * placed into a {@link Scheduler} - *
- */ - public JobDetail() { - // do nothing... - } - - /** - *
- * Create a JobDetail with the given name, and group, and
- * the default settings of all the other properties.
- *
null, Scheduler.DEFAULT_GROUP will be used.
- *
- * @exception IllegalArgumentException
- * if nameis null or empty, or the group is an empty string.
- */
- public JobDetail(String name, String group, Class jobClass) {
- setName(name);
- setGroup(group);
- setJobClass(jobClass);
- }
-
- /**
- *
- * Create a JobDetail with the given name, and group, and
- * the given settings of all the other properties.
- *
null, Scheduler.DEFAULT_GROUP will be used.
- *
- * @exception IllegalArgumentException
- * if nameis null or empty, or the group is an empty string.
- */
- public JobDetail(String name, String group, Class jobClass,
- boolean volatility, boolean durability, boolean recover) {
- setName(name);
- setGroup(group);
- setJobClass(jobClass);
- setVolatility(volatility);
- setDurability(durability);
- setRequestsRecovery(recover);
- }
-
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Interface.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
- /**
- *
- * Get the name of this Job.
- *
- * Set the name of this Job.
- *
- * Get the group of this Job.
- *
- * Set the group of this Job.
- *
null, Scheduler.DEFAULT_GROUP will be used.
- *
- * @exception IllegalArgumentException
- * if the group is an empty string.
- */
- public void setGroup(String group) {
- if (group != null && group.trim().length() == 0)
- throw new IllegalArgumentException(
- "Group name cannot be empty.");
-
- if(group == null)
- group = Scheduler.DEFAULT_GROUP;
-
- this.group = group;
- }
-
- /**
- *
- * Returns the 'full name' of the Trigger in the format
- * "group.name".
- *
* Return the description given to the Job instance by its
* creator (if any).
*
- * Set a description for the Job instance - may be useful
- * for remembering/displaying the purpose of the job, though the
- * description has no meaning to Quartz.
- *
* Get the instance of Job that will be executed.
*
- * Set the instance of Job that will be executed.
- *
Job.
- */
- public void setJobClass(Class jobClass) {
- if (jobClass == null)
- throw new IllegalArgumentException("Job class cannot be null.");
-
- if (!Job.class.isAssignableFrom(jobClass))
- throw new IllegalArgumentException(
- "Job class must implement the Job interface.");
-
- this.jobClass = jobClass;
- }
-
- /**
- *
* Get the JobDataMap that is associated with the Job.
*
- * Set the JobDataMap to be associated with the Job.
- *
- * Validates whether the properties of the JobDetail are
- * valid for submission into a Scheduler.
- *
- * @throws IllegalStateException
- * if a required property (such as Name, Group, Class) is not
- * set.
- */
- public void validate() throws SchedulerException {
- if (name == null)
- throw new SchedulerException("Job's name cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
-
- if (group == null)
- throw new SchedulerException("Job's group cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
-
- if (jobClass == null)
- throw new SchedulerException("Job's class cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
- }
-
- /**
- *
- * Set whether or not the Job should be persisted in the
- * {@link org.quartz.spi.JobStore} for re-use after program
- * restarts.
- *
- * If not explicitly set, the default value is false.
- *
- * Set whether or not the Job should remain stored after it
- * is orphaned (no {@link Trigger}s point to it).
- *
- * If not explicitly set, the default value is false.
- *
- * Set whether or not the the Scheduler should re-execute
- * the Job if a 'recovery' or 'fail-over' situation is
- * encountered.
- *
- * If not explicitly set, the default value is false.
- *
- * Whether or not the Job should not be persisted in the
- * {@link org.quartz.spi.JobStore} for re-use after program
- * restarts.
- *
- * If not explicitly set, the default value is false.
- *
true if the Job should be garbage
- * collected along with the {@link Scheduler}.
- */
- public boolean isVolatile() {
- return volatility;
- }
-
- /**
- *
* Whether or not the Job should remain stored after it is
* orphaned (no {@link Trigger}s point to it).
*
true if the Job should remain persisted after
* being orphaned.
*/
- public boolean isDurable() {
- return durability;
- }
+ public boolean isDurable();
/**
- *
- * Whether or not the Job implements the interface {@link StatefulJob}.
- *
@@ -413,70 +113,15 @@ *
* * @see JobExecutionContext#isRecovering() - * @see JobExecutionContext#isFailedOver() */ - public boolean requestsRecovery() { - return shouldRecover; - } + public boolean requestsRecovery(); + public Object clone(); + /** - *
- * Add the specified name of a {@link JobListener} to the
- * end of the Job's list of listeners.
- *
JobDetail identical to this one.
*/
- public void addJobListener(String name) {
- jobListeners.add(name);
- }
+ public JobBuilder getJobBuilder();
- /**
- *
- * Remove the specified name of a {@link JobListener} from
- * the Job's list of listeners.
- *
- * Returns an array of String s containing the names of all
- * {@link JobListener} s assigned to the Job,
- * in the order in which they should be notified.
- *
- * Return a simple string representation of this object. - *
- */ - public String toString() { - return "JobDetail '" + getFullName() + "': jobClass: '" - + ((getJobClass() == null) ? null : getJobClass().getName()) - + " isStateful: " + isStateful() + " isVolatile: " - + isVolatile() + " isDurable: " + isDurable() - + " requestsRecovers: " + requestsRecovery(); - } - - public Object clone() { - JobDetail copy; - try { - copy = (JobDetail) super.clone(); - copy.jobListeners = (ArrayList) jobListeners.clone(); - if (jobDataMap != null) - copy.jobDataMap = (JobDataMap) jobDataMap.clone(); - } catch (CloneNotSupportedException ex) { - throw new IncompatibleClassChangeError("Not Cloneable."); - } - - return copy; - } - -} +} \ No newline at end of file Index: 3rdParty_sources/quartz/org/quartz/JobExecutionContext.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/JobExecutionContext.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/JobExecutionContext.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/JobExecutionContext.java 15 Dec 2014 10:09:46 -0000 1.1.2.1 @@ -1,6 +1,5 @@ - -/* - * Copyright 2004-2005 OpenSymphony +/* + * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -16,23 +15,15 @@ * */ -/* - * Previously Copyright (c) 2001-2004 James House - */ package org.quartz; import java.util.Date; -import java.util.HashMap; -import org.quartz.spi.TriggerFiredBundle; - /** - *
* A context bundle containing handles to various environment information, that
* is given to a {@link org.quartz.JobDetail} instance as it is
* executed, and to a {@link Trigger} instance after the
* execution completes.
- *
* The JobDataMap found on this object (via the
@@ -43,13 +34,14 @@
* It is thus considered a 'best practice' that the execute code of a Job
* retrieve data from the JobDataMap found on this object NOTE: Do not
* expect value 'set' into this JobDataMap to somehow be set back onto a
- * StatefulJob's own JobDataMap.
+ * job's own JobDataMap - even if it has the
+ * @PersistJobDataAfterExecution annotation.
*
* JobExecutionContext s are also returned from the
* Scheduler.getCurrentlyExecutingJobs()
- * method. These are the same instances as those past into the jobs that are
+ * method. These are the same instances as those passed into the jobs that are
* currently executing within the scheduler. The exception to this is when your
* application is using Quartz remotely (i.e. via RMI) - in which case you get
* a clone of the JobExecutionContexts, and their references to
@@ -58,145 +50,66 @@
* to the job instance that is running).
*
- * Create a JobExcecutionContext with the given context data. - *
- */ - public JobExecutionContext(Scheduler scheduler, - TriggerFiredBundle firedBundle, Job job) { - this.scheduler = scheduler; - this.trigger = firedBundle.getTrigger(); - this.calendar = firedBundle.getCalendar(); - this.jobDetail = firedBundle.getJobDetail(); - this.job = job; - this.recovering = firedBundle.isRecovering(); - this.fireTime = firedBundle.getFireTime(); - this.scheduledFireTime = firedBundle.getScheduledFireTime(); - this.prevFireTime = firedBundle.getPrevFireTime(); - this.nextFireTime = firedBundle.getNextFireTime(); - - this.jobDataMap = new JobDataMap(); - this.jobDataMap.putAll(jobDetail.getJobDataMap()); - this.jobDataMap.putAll(trigger.getJobDataMap()); - - this.jobDataMap.setMutable(false); - this.trigger.getJobDataMap().setMutable(false); - } - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - *
* Get a handle to the Scheduler instance that fired the
* Job.
*
* Get a handle to the Trigger instance that fired the
* Job.
*
* Get a handle to the Calendar referenced by the Trigger
* instance that fired the Job.
*
* If the Job is being re-executed because of a 'recovery'
* situation, this method will return true.
*
+ * When recovering a previously failed job execution this method returns the identity + * of the originally firing trigger. This recovering job will have been scheduled for + * the same firing time as the original job, and so is available via the + * {@link #getScheduledFireTime()} method. The original firing time of the job can be + * accessed via the {@link Scheduler#FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS} + * element of this job's {@code JobDataMap}. + * + * @return the recovering trigger details + * @throws IllegalStateException if this is not a recovering job. + */ + public TriggerKey getRecoveringTriggerKey() throws IllegalStateException; - public int getRefireCount() { - return numRefires; - } + public int getRefireCount(); /** *
@@ -209,12 +122,12 @@
* JobDetail and the one found on the Trigger, with
* the value in the latter overriding any same-named values in the former.
* It is thus considered a 'best practice' that the execute code of a Job
- * retrieve data from the JobDataMap found on this object
+ * retrieve data from the JobDataMap found on this object.
*
NOTE: Do not
- * expect value 'set' into this JobDataMap to somehow be set back onto a
- * StatefulJob's own JobDataMap.
+ *
NOTE: Do not expect value 'set' into this JobDataMap to somehow be set
+ * or persisted back onto a job's own JobDataMap - even if it has the
+ * @PersistJobDataAfterExecution annotation.
*
@@ -223,18 +136,14 @@ *
* */ - public JobDataMap getMergedJobDataMap() { - return jobDataMap; - } + public JobDataMap getMergedJobDataMap(); /** *
* Get the JobDetail associated with the Job.
*
@@ -247,9 +156,7 @@ * interfaces. *
*/ - public Job getJobInstance() { - return job; - } + public Job getJobInstance(); /** * The actual time the trigger fired. For instance the scheduled time may @@ -259,9 +166,7 @@ * @return Returns the fireTime. * @see #getScheduledFireTime() */ - public Date getFireTime() { - return fireTime; - } + public Date getFireTime(); /** * The scheduled time the trigger fired for. For instance the scheduled @@ -271,29 +176,23 @@ * @return Returns the scheduledFireTime. * @see #getFireTime() */ - public Date getScheduledFireTime() { - return scheduledFireTime; - } + public Date getScheduledFireTime(); - public Date getPreviousFireTime() { - return prevFireTime; - } + public Date getPreviousFireTime(); - public Date getNextFireTime() { - return nextFireTime; - } + public Date getNextFireTime(); - public String toString() { - return "JobExecutionContext:" + " trigger: '" - + getTrigger().getFullName() + " job: " - + getJobDetail().getFullName() + " fireTime: '" + getFireTime() - + " scheduledFireTime: " + getScheduledFireTime() - + " previousFireTime: '" + getPreviousFireTime() - + " nextFireTime: " + getNextFireTime() + " isRecovering: " - + isRecovering() + " refireCount: " + getRefireCount(); - } - /** + * Get the unique Id that identifies this particular firing instance of the + * trigger that triggered this job execution. It is unique to this + * JobExecutionContext instance as well. + * + * @return the unique fire instance id + * @see Scheduler#interrupt(String) + */ + public String getFireInstanceId(); + + /** * Returns the result (if any) that theJob set before its
* execution completed (the type of object set as the result is entirely up
* to the particular job).
@@ -307,10 +206,8 @@
*
* @return Returns the result.
*/
- public Object getResult() {
- return result;
- }
-
+ public Object getResult();
+
/**
* Set the result (if any) of the Job's execution (the type of
* object set as the result is entirely up to the particular job).
@@ -321,13 +218,9 @@
* {@link TriggerListener}s that are watching the job's
* execution.
*
- *
- * @return Returns the result.
*/
- public void setResult(Object result) {
- this.result = result;
- }
-
+ public void setResult(Object result);
+
/**
* The amount of time the job ran for (in milliseconds). The returned
* value will be -1 until the job has actually completed (or thrown an
@@ -336,16 +229,7 @@
*
* @return Returns the jobRunTime.
*/
- public long getJobRunTime() {
- return jobRunTime;
- }
-
- /**
- * @param jobRunTime The jobRunTime to set.
- */
- public void setJobRunTime(long jobRunTime) {
- this.jobRunTime = jobRunTime;
- }
+ public long getJobRunTime();
/**
* Put the specified value into the context's data map with the given key.
@@ -355,19 +239,16 @@
* completes, and all TriggerListeners and JobListeners have been
* notified.
*
- * @param key
- * @param value
+ * @param key the key for the associated value
+ * @param value the value to store
*/
- public void put(Object key, Object value) {
- data.put(key, value);
- }
-
+ public void put(Object key, Object value);
+
/**
* Get the value with the given key from the context's data map.
*
- * @param key
+ * @param key the key for the desired value
*/
- public Object get(Object key) {
- return data.get(key);
- }
-}
+ public Object get(Object key);
+
+}
\ No newline at end of file
Index: 3rdParty_sources/quartz/org/quartz/JobExecutionException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/JobExecutionException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/JobExecutionException.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/JobExecutionException.java 15 Dec 2014 10:09:46 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,19 +16,14 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
/**
- *
* An exception that can be thrown by a {@link org.quartz.Job}
* to indicate to the Quartz {@link Scheduler} that an error
- * occured while executing, and whether or not the Job requests
+ * occurred while executing, and whether or not the Job requests
* to be re-fired immediately (using the same {@link JobExecutionContext},
* or whether it wants to be unscheduled.
- *
* Note that if the flag for 'refire immediately' is set, the flags for @@ -43,6 +38,8 @@ */ public class JobExecutionException extends SchedulerException { + private static final long serialVersionUID = 1326342535829043325L; + /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -79,7 +76,7 @@ * Create a JobExcecutionException, with the given cause. *
*/ - public JobExecutionException(Exception cause) { + public JobExecutionException(Throwable cause) { super(cause); } @@ -108,7 +105,7 @@ * the 're-fire immediately' flag set to the given value. * */ - public JobExecutionException(Exception cause, boolean refireImmediately) { + public JobExecutionException(Throwable cause, boolean refireImmediately) { super(cause); refire = refireImmediately; @@ -117,16 +114,36 @@ /** ** Create a JobExcecutionException with the given message, and underlying + * exception. + *
+ */ + public JobExecutionException(String msg, Throwable cause) { + super(msg, cause); + } + + /** + *+ * Create a JobExcecutionException with the given message, and underlying * exception, and the 're-fire immediately' flag set to the given value. *
*/ - public JobExecutionException(String msg, Exception cause, + public JobExecutionException(String msg, Throwable cause, boolean refireImmediately) { super(msg, cause); refire = refireImmediately; } + + /** + * Create a JobExcecutionException with the given message and the 're-fire + * immediately' flag set to the given value. + */ + public JobExecutionException(String msg, boolean refireImmediately) { + super(msg); + refire = refireImmediately; + } + /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -135,6 +152,10 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + public void setRefireImmediately(boolean refire) { + this.refire = refire; + } + public boolean refireImmediately() { return refire; } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/JobKey.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/quartz/org/quartz/JobListener.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/JobListener.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/JobListener.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/JobListener.java 15 Dec 2014 10:09:47 -0000 1.1.2.1 @@ -1,6 +1,6 @@ /* - * Copyright 2004-2005 OpenSymphony + * Copyright 2001-2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -16,20 +16,16 @@ * */ -/* - * Previously Copyright (c) 2001-2004 James House - */ package org.quartz; /** - *
* The interface to be implemented by classes that want to be informed when a
* {@link org.quartz.JobDetail} executes. In general,
* applications that use a Scheduler will not have use for this
* mechanism.
- *
JobListener.
*
*/
- public String getName();
+ String getName();
/**
*
* Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
* is about to be executed (an associated {@link Trigger}
- * has occured).
+ * has occurred).
*
@@ -68,19 +64,19 @@ * * @see #jobExecutionVetoed(JobExecutionContext) */ - public void jobToBeExecuted(JobExecutionContext context); + void jobToBeExecuted(JobExecutionContext context); /** *
* Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
* was about to be executed (an associated {@link Trigger}
- * has occured), but a {@link TriggerListener} vetoed it's
+ * has occurred), but a {@link TriggerListener} vetoed it's
* execution.
*
triggered(xx) method has been called.
*
*/
- public void jobWasExecuted(JobExecutionContext context,
+ void jobWasExecuted(JobExecutionContext context,
JobExecutionException jobException);
}
Index: 3rdParty_sources/quartz/org/quartz/JobPersistenceException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/JobPersistenceException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/JobPersistenceException.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/JobPersistenceException.java 15 Dec 2014 10:09:47 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,20 +16,17 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
/**
- * * An exception that is thrown to indicate that there has been a failure in the * scheduler's underlying persistence mechanism. - *
* * @author James House */ public class JobPersistenceException extends SchedulerException { + + private static final long serialVersionUID = -8924958757341995694L; /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -46,38 +43,17 @@ */ public JobPersistenceException(String msg) { super(msg); - setErrorCode(ERR_PERSISTENCE); } - /** - *
- * Create a JobPersistenceException with the given message
- * and error code.
- *
* Create a JobPersistenceException with the given message
* and cause.
*
- * Create a JobPersistenceException with the given message,
- * cause and error code.
- *
* An exception that is thrown to indicate that an attempt to store a new
* object (i.e. {@link org.quartz.JobDetail},{@link Trigger}
* or {@link Calendar}) in a {@link Scheduler}
* failed, because one with the same name & group already exists.
- *
* This is the main interface of a Quartz Scheduler. - *
* *
- * A Scheduler maintains a registery of {@link org.quartz.JobDetail}
- * s and {@link Trigger}s. Once registered, the Scheduler
- * is responible for executing Job s when their associated
+ * A Scheduler maintains a registry of {@link org.quartz.JobDetail}s
+ * and {@link Trigger}s. Once registered, the Scheduler
+ * is responsible for executing Job s when their associated
* Trigger s fire (when their scheduled time arrives).
*
Job executions. The {@link TriggerListener}
* interface provides notifications of Trigger firings. The
* {@link SchedulerListener} interface provides notifications of
- * Scheduler events and errors.
+ * Scheduler events and errors. Listeners can be associated with
+ * local schedulers through the {@link ListenerManager} interface.
*
*
* @@ -97,7 +97,9 @@ * * @see Job * @see JobDetail + * @see JobBuilder * @see Trigger + * @see TriggerBuilder * @see JobListener * @see TriggerListener * @see SchedulerListener @@ -116,40 +118,78 @@ */ /** - *
- * A (possibly) usefull constant that can be used for specifying the group
+ * A (possibly) useful constant that can be used for specifying the group
* that Job and Trigger instances belong to.
- *
* A constant Trigger group name used internally by the
* scheduler - clients should not use the value of this constant
- * ("MANUAL_TRIGGER") for thename of a Trigger's group.
- *
Trigger's group.
+ *
+ * @see org.quartz.JobDetail#requestsRecovery()
*/
- public static final String DEFAULT_MANUAL_TRIGGERS = "MANUAL_TRIGGER";
+ String DEFAULT_RECOVERY_GROUP = "RECOVERING_JOBS";
/**
- *
* A constant Trigger group name used internally by the
* scheduler - clients should not use the value of this constant
- * ("RECOVERING_JOBS") for thename of a Trigger's group.
- *
Trigger's group.
+ *
+ * @see org.quartz.JobDetail#requestsRecovery()
*/
- public static final String DEFAULT_RECOVERY_GROUP = "RECOVERING_JOBS";
+ String DEFAULT_FAIL_OVER_GROUP = "FAILED_OVER_JOBS";
+
/**
- *
- * A constant Trigger group name used internally by the
- * scheduler - clients should not use the value of this constant
- * ("FAILED_OVER_JOBS") for thename of a Trigger's group.
- *
JobDataMap key that can be used to retrieve the
+ * name of the original Trigger from a recovery trigger's
+ * data map in the case of a job recovering after a failed scheduler
+ * instance.
+ *
+ * @see org.quartz.JobDetail#requestsRecovery()
*/
- public static final String DEFAULT_FAIL_OVER_GROUP = "FAILED_OVER_JOBS";
+ String FAILED_JOB_ORIGINAL_TRIGGER_NAME = "QRTZ_FAILED_JOB_ORIG_TRIGGER_NAME";
+ /**
+ * A constant JobDataMap key that can be used to retrieve the
+ * group of the original Trigger from a recovery trigger's
+ * data map in the case of a job recovering after a failed scheduler
+ * instance.
+ *
+ * @see org.quartz.JobDetail#requestsRecovery()
+ */
+ String FAILED_JOB_ORIGINAL_TRIGGER_GROUP = "QRTZ_FAILED_JOB_ORIG_TRIGGER_GROUP";
+
+ /**
+ * A constant JobDataMap key that can be used to retrieve the
+ * fire time of the original Trigger from a recovery
+ * trigger's data map in the case of a job recovering after a failed scheduler
+ * instance.
+ *
+ * Note that this is the time the original firing actually occurred, + * which may be different from the scheduled fire time - as a trigger doesn't + * always fire exactly on time.
+ * + * @see org.quartz.JobDetail#requestsRecovery() + */ + String FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS = "QRTZ_FAILED_JOB_ORIG_TRIGGER_FIRETIME_IN_MILLISECONDS_AS_STRING"; + + /** + * A constantJobDataMap key that can be used to retrieve the
+ * scheduled fire time of the original Trigger from a recovery
+ * trigger's data map in the case of a job recovering after a failed scheduler
+ * instance.
+ *
+ * Note that this is the time the original firing was scheduled for, + * which may be different from the actual firing time - as a trigger doesn't + * always fire exactly on time.
+ * + * @see org.quartz.JobDetail#requestsRecovery() + */ + String FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS = "QRTZ_FAILED_JOB_ORIG_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS_AS_STRING"; + /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -159,39 +199,31 @@ */ /** - *
* Returns the name of the Scheduler.
- *
* Returns the instance Id of the Scheduler.
- *
* Returns the SchedulerContext of the Scheduler.
- *
* Starts the Scheduler's threads that fire {@link Trigger}s.
* When a scheduler is first created it is in "stand-by" mode, and will not
* fire triggers. The scheduler can also be put into stand-by mode by
* calling the standby() method.
- *
* The misfire/recovery process will be started, if it is the initial call
@@ -201,17 +233,48 @@
* @throws SchedulerException
* if shutdown() has been called, or there is an
* error within the Scheduler.
- *
- * @see #standby
- * @see #shutdown
+ *
+ * @see #startDelayed(int)
+ * @see #standby()
+ * @see #shutdown()
*/
- public void start() throws SchedulerException;
+ void start() throws SchedulerException;
/**
+ * Calls {#start()} after the indicated number of seconds.
+ * (This call does not block). This can be useful within applications that
+ * have initializers that create the scheduler immediately, before the
+ * resources needed by the executing jobs have been fully initialized.
+ *
+ * @throws SchedulerException
+ * if shutdown() has been called, or there is an
+ * error within the Scheduler.
+ *
+ * @see #start()
+ * @see #standby()
+ * @see #shutdown()
+ */
+ void startDelayed(int seconds) throws SchedulerException;
+
+ /**
+ * Whether the scheduler has been started.
+ *
*
- * Temporarily halts the Scheduler's firing of {@link Trigger}s.
+ * Note: This only reflects whether {@link #start()} has ever
+ * been called on this Scheduler, so it will return true even
+ * if the Scheduler is currently in standby mode or has been
+ * since shutdown.
*
Scheduler's firing of {@link Trigger}s.
+ *
*
* When start() is called (to bring the scheduler out of
* stand-by mode), trigger misfire instructions will NOT be applied
@@ -227,50 +290,32 @@
* @see #start()
* @see #pauseAll()
*/
- public void standby() throws SchedulerException;
+ void standby() throws SchedulerException;
/**
- * @deprecated replaced by better-named standby() method.
- * @see #standby()
- */
- public void pause() throws SchedulerException;
-
- /**
- *
* Reports whether the Scheduler is in stand-by mode.
- *
* Halts the Scheduler's firing of {@link Trigger}s,
* and cleans up all resources associated with the Scheduler. Equivalent to
* shutdown(false).
- *
* The scheduler cannot be re-started. *
* * @see #shutdown(boolean) */ - public void shutdown() throws SchedulerException; + void shutdown() throws SchedulerException; /** - *
* Halts the Scheduler's firing of {@link Trigger}s,
* and cleans up all resources associated with the Scheduler.
- *
* The scheduler cannot be re-started. @@ -282,33 +327,33 @@ * * @see #shutdown */ - public void shutdown(boolean waitForJobsToComplete) - throws SchedulerException; + void shutdown(boolean waitForJobsToComplete) + throws SchedulerException; /** - *
* Reports whether the Scheduler has been shutdown.
- *
- * Get a SchedulerMetaData object describiing the settings
+ * Get a SchedulerMetaData object describing the settings
* and capabilities of the scheduler instance.
- *
* Note that the data returned is an 'instantaneous' snap-shot, and that as * soon as it's returned, the meta data values may be different. *
*/ - public SchedulerMetaData getMetaData() throws SchedulerException; + SchedulerMetaData getMetaData() throws SchedulerException; /** - *
* Return a list of JobExecutionContext objects that
- * represent all currently executing Jobs.
+ * represent all currently executing Jobs in this Scheduler instance.
+ *
+ *
+ * This method is not cluster aware. That is, it will only return Jobs + * currently executing in this Scheduler instance, not across the entire + * cluster. *
* *
@@ -320,37 +365,46 @@
*
* @see JobExecutionContext
*/
- public List getCurrentlyExecutingJobs() throws SchedulerException;
+ List
* Set the
* JobFactories may be of use to those wishing to have their application
* produce
* Add the given
* If the given Trigger does not reference any
* Schedule the given
+ * Schedule all of the given jobs with the related set of triggers.
+ *
+ * If any of the given jobs or triggers already exist (or more
+ * specifically, if the keys are not unique) and the replace
+ * parameter is not set to true then an exception will be thrown. If any of the given job or triggers already exist (or more
+ * specifically, if the keys are not unique) and the replace
+ * parameter is not set to true then an exception will be thrown.JobFactory that will be responsible for producing
* instances of Job classes.
- * Job instances via some special mechanism, such as to
- * give the opertunity for dependency injection.
+ * give the opportunity for dependency injection.
* ListenerManager,
+ * through which listeners may be registered.
+ *
+ * @return the scheduler's ListenerManager
+ * @throws SchedulerException if the scheduler is not local
+ * @see ListenerManager
+ * @see JobListener
+ * @see TriggerListener
+ * @see SchedulerListener
+ */
+ ListenerManager getListenerManager() throws SchedulerException;
+
///////////////////////////////////////////////////////////////////////////
///
/// Scheduling-related Methods
///
///////////////////////////////////////////////////////////////////////////
/**
- * {@link org.quartz.JobDetail} to the
* Scheduler, and associate the given {@link Trigger} with
* it.
- * Job, then it
@@ -361,272 +415,327 @@
* if the Job or Trigger cannot be added to the Scheduler, or
* there is an internal Scheduler error.
*/
- public Date scheduleJob(JobDetail jobDetail, Trigger trigger)
- throws SchedulerException;
+ Date scheduleJob(JobDetail jobDetail, Trigger trigger)
+ throws SchedulerException;
/**
- * {@link org.quartz.Trigger} with the
* Job identified by the Trigger's settings.
- * {@link Trigger} from the scheduler.
- *
If the related job does not have any other triggers, and the job is + * not durable, then the job will also be deleted.
*/ - public boolean unscheduleJob(String triggerName, String groupName) - throws SchedulerException; + boolean unscheduleJob(TriggerKey triggerKey) + throws SchedulerException; /** - *
+ * Remove all of the indicated {@link Trigger}s from the scheduler.
+ *
+ *
If the related job does not have any other triggers, and the job is + * not durable, then the job will also be deleted.
+ * + *Note that while this bulk operation is likely more efficient than
+ * invoking unscheduleJob(TriggerKey triggerKey) several
+ * times, it may have the adverse affect of holding data locks for a
+ * single long duration of time (rather than lots of small durations
+ * of time).
{@link org.quartz.Trigger} with the
- * given name, and store the new given one - which must be associated
+ * given key, and store the new given one - which must be associated
* with the same job (the new trigger must have the job name & group specified)
* - however, the new trigger need not have the same name as the old trigger.
- *
*
- * @param triggerName
- * The name of the Trigger to be replaced.
- * @param groupName
- * The group name of the Trigger to be replaced.
+ * @param triggerKey identity of the trigger to replace
* @param newTrigger
* The new Trigger to be stored.
+ *
* @return null if a Trigger with the given
- * name & group was not found and removed from the store, otherwise
- * the first fire time of the newly scheduled trigger.
+ * name & group was not found and removed from the store (and the
+ * new trigger is therefore not stored), otherwise
+ * the first fire time of the newly scheduled trigger is returned.
*/
- public Date rescheduleJob(String triggerName,
- String groupName, Trigger newTrigger) throws SchedulerException;
-
+ Date rescheduleJob(TriggerKey triggerKey, Trigger newTrigger)
+ throws SchedulerException;
/**
- *
* Add the given Job to the Scheduler - with no associated
* Trigger. The Job will be 'dormant' until
* it is scheduled with a Trigger, or Scheduler.triggerJob()
* is called for it.
- *
* The Job must by definition be 'durable', if it is not,
* SchedulerException will be thrown.
*
replace is false.
*/
- public void addJob(JobDetail jobDetail, boolean replace)
- throws SchedulerException;
+ void addJob(JobDetail jobDetail, boolean replace)
+ throws SchedulerException;
/**
+ * Add the given Job to the Scheduler - with no associated
+ * Trigger. The Job will be 'dormant' until
+ * it is scheduled with a Trigger, or Scheduler.triggerJob()
+ * is called for it.
+ *
*
+ * With the storeNonDurableWhileAwaitingScheduling parameter
+ * set to true, a non-durable job can be stored. Once it is
+ * scheduled, it will resume normal non-durable behavior (i.e. be deleted
+ * once there are no remaining associated triggers).
+ *
replace is false.
+ */
+ void addJob(JobDetail jobDetail, boolean replace, boolean storeNonDurableWhileAwaitingScheduling)
+ throws SchedulerException;
+
+ /**
* Delete the identified Job from the Scheduler - and any
* associated Triggers.
- *
*
* @return true if the Job was found and deleted.
* @throws SchedulerException
* if there is an internal Scheduler error.
*/
- public boolean deleteJob(String jobName, String groupName)
- throws SchedulerException;
+ boolean deleteJob(JobKey jobKey)
+ throws SchedulerException;
/**
- *
- * Trigger the identified {@link org.quartz.JobDetail}
- * (execute it now) - the generated trigger will be non-volatile.
- *
Jobs from the Scheduler - and any
+ * associated Triggers.
+ *
+ * Note that while this bulk operation is likely more efficient than
+ * invoking deleteJob(JobKey jobKey) several
+ * times, it may have the adverse affect of holding data locks for a
+ * single long duration of time (rather than lots of small durations
+ * of time).
* Trigger the identified {@link org.quartz.JobDetail}
- * (execute it now) - the generated trigger will be volatile.
- *
* Trigger the identified {@link org.quartz.JobDetail}
- * (execute it now) - the generated trigger will be non-volatile.
- *
null) JobDataMap to be
* associated with the trigger that fires the job immediately.
*/
- public void triggerJob(String jobName, String groupName, JobDataMap data)
- throws SchedulerException;
+ void triggerJob(JobKey jobKey, JobDataMap data)
+ throws SchedulerException;
/**
- *
- * Trigger the identified {@link org.quartz.JobDetail}
- * (execute it now) - the generated trigger will be volatile.
- *
null) JobDataMap to be
- * associated with the trigger that fires the job immediately.
- */
- public void triggerJobWithVolatileTrigger(String jobName, String groupName, JobDataMap data)
- throws SchedulerException;
-
- /**
- *
* Pause the {@link org.quartz.JobDetail} with the given
- * name - by pausing all of its current Triggers.
- *
Triggers.
*
- * @see #resumeJob(String, String)
+ * @see #resumeJob(JobKey)
*/
- public void pauseJob(String jobName, String groupName)
- throws SchedulerException;
+ void pauseJob(JobKey jobKey)
+ throws SchedulerException;
/**
- *
* Pause all of the {@link org.quartz.JobDetail}s in the
- * given group - by pausing all of their Triggers.
- *
Triggers.
+ *
* - * The Scheduler will "remember" that the group is paused, and impose the - * pause on any new jobs that are added to the group while the group is - * paused. + * The Scheduler will "remember" the groups paused, and impose the + * pause on any new jobs that are added to any of those groups + * until it is resumed. *
* - * @see #resumeJobGroup(String) + *NOTE: There is a limitation that only exactly matched groups + * can be remembered as paused. For example, if there are pre-existing + * job in groups "aaa" and "bbb" and a matcher is given to pause + * groups that start with "a" then the group "aaa" will be remembered + * as paused and any subsequently added jobs in group "aaa" will be paused, + * however if a job is added to group "axx" it will not be paused, + * as "axx" wasn't known at the time the "group starts with a" matcher + * was applied. HOWEVER, if there are pre-existing groups "aaa" and + * "bbb" and a matcher is given to pause the group "axx" (with a + * group equals matcher) then no jobs will be paused, but it will be + * remembered that group "axx" is paused and later when a job is added + * in that group, it will become paused.
+ * + * @param matcher The matcher to evaluate against know groups + * @throws SchedulerException On error + * @see #resumeJobs(org.quartz.impl.matchers.GroupMatcher) */ - public void pauseJobGroup(String groupName) throws SchedulerException; + void pauseJobs(GroupMatcher
- * Pause the {@link Trigger} with the given name.
- *
{@link Trigger} with the given key.
*
- * @see #resumeTrigger(String, String)
+ * @see #resumeTrigger(TriggerKey)
*/
- public void pauseTrigger(String triggerName, String groupName)
- throws SchedulerException;
+ void pauseTrigger(TriggerKey triggerKey)
+ throws SchedulerException;
/**
- *
- * Pause all of the {@link Trigger}s in the given group.
- *
{@link Trigger}s in the groups matching.
*
* - * The Scheduler will "remember" that the group is paused, and impose the - * pause on any new triggers that are added to the group while the group is - * paused. + * The Scheduler will "remember" all the groups paused, and impose the + * pause on any new triggers that are added to any of those groups + * until it is resumed. *
* - * @see #resumeTriggerGroup(String) + *NOTE: There is a limitation that only exactly matched groups + * can be remembered as paused. For example, if there are pre-existing + * triggers in groups "aaa" and "bbb" and a matcher is given to pause + * groups that start with "a" then the group "aaa" will be remembered as + * paused and any subsequently added triggers in that group be paused, + * however if a trigger is added to group "axx" it will not be paused, + * as "axx" wasn't known at the time the "group starts with a" matcher + * was applied. HOWEVER, if there are pre-existing groups "aaa" and + * "bbb" and a matcher is given to pause the group "axx" (with a + * group equals matcher) then no triggers will be paused, but it will be + * remembered that group "axx" is paused and later when a trigger is added + * in that group, it will become paused.
+ * + * @param matcher The matcher to evaluate against know groups + * @throws SchedulerException + * @see #resumeTriggers(org.quartz.impl.matchers.GroupMatcher) */ - public void pauseTriggerGroup(String groupName) throws SchedulerException; + void pauseTriggers(GroupMatcher
* Resume (un-pause) the {@link org.quartz.JobDetail} with
- * the given name.
- *
* If any of the Job'sTrigger s missed one
* or more fire-times, then the Trigger's misfire
* instruction will be applied.
*
* Resume (un-pause) all of the {@link org.quartz.JobDetail}s
- * in the given group.
- *
* If any of the Job s had Trigger s that
* missed one or more fire-times, then the Trigger's
* misfire instruction will be applied.
*
* Resume (un-pause) the {@link Trigger} with the given
- * name.
- *
* If the Trigger missed one or more fire-times, then the
* Trigger's misfire instruction will be applied.
*
- * Resume (un-pause) all of the {@link Trigger}s in the
- * given group.
- *
{@link Trigger}s in matching groups.
*
*
* If any Trigger missed one or more fire-times, then the
* Trigger's misfire instruction will be applied.
*
* Pause all triggers - similar to calling pauseTriggerGroup(group)
* on every group, however, after using this method resumeAll()
* must be called to clear the scheduler's state of 'remembering' that all
* new triggers will be paused as they are added.
- *
* When resumeAll() is called (to un-pause), trigger misfire
* instructions WILL be applied.
*
* Resume (un-pause) all triggers - similar to calling
* resumeTriggerGroup(group) on every group.
- *
* If any Trigger missed one or more fire-times, then the
@@ -635,95 +744,89 @@
*
* @see #pauseAll()
*/
- public void resumeAll() throws SchedulerException;
+ void resumeAll() throws SchedulerException;
/**
- *
* Get the names of all known {@link org.quartz.JobDetail}
* groups.
- *
- * Get the names of all the {@link org.quartz.JobDetail}s
- * in the given group.
- *
{@link org.quartz.JobDetail}s
+ * in the matching groups.
+ * @param matcher Matcher to evaluate against known groups
+ * @return Set of all keys matching
+ * @throws SchedulerException On error
*/
- public String[] getJobNames(String groupName) throws SchedulerException;
+ Set
* Get all {@link Trigger} s that are associated with the
* identified {@link org.quartz.JobDetail}.
+ *
+ *
The returned Trigger objects will be snap-shots of the actual stored + * triggers. If you wish to modify a trigger, you must re-store the + * trigger afterward (e.g. see {@link #rescheduleJob(TriggerKey, Trigger)}). *
+ * */ - public Trigger[] getTriggersOfJob(String jobName, String groupName) - throws SchedulerException; + List extends Trigger> getTriggersOfJob(JobKey jobKey) + throws SchedulerException; /** - *
* Get the names of all known {@link Trigger} groups.
- *
* Get the names of all the {@link Trigger}s in the given
* group.
- *
* Get the names of all {@link Trigger} groups that are paused.
- *
* Get the {@link JobDetail} for the Job
- * instance with the given name and group.
+ * instance with the given key.
+ *
+ *
The returned JobDetail object will be a snap-shot of the actual stored + * JobDetail. If you wish to modify the JobDetail, you must re-store the + * JobDetail afterward (e.g. see {@link #addJob(JobDetail, boolean)}). *
+ * */ - public JobDetail getJobDetail(String jobName, String jobGroup) - throws SchedulerException; + JobDetail getJobDetail(JobKey jobKey) + throws SchedulerException; /** - *
- * Get the {@link Trigger} instance with the given name and
- * group.
+ * Get the {@link Trigger} instance with the given key.
+ *
+ *
The returned Trigger object will be a snap-shot of the actual stored + * trigger. If you wish to modify the trigger, you must re-store the + * trigger afterward (e.g. see {@link #rescheduleJob(TriggerKey, Trigger)}). *
*/ - public Trigger getTrigger(String triggerName, String triggerGroup) - throws SchedulerException; + Trigger getTrigger(TriggerKey triggerKey) + throws SchedulerException; /** - *
* Get the current state of the identified {@link Trigger}.
- *
* Add (register) the given Calendar to the Scheduler.
- *
replace is
* false.
*/
- public void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers)
- throws SchedulerException;
+ void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers)
+ throws SchedulerException;
/**
- *
* Delete the identified Calendar from the Scheduler.
+ *
+ *
+ * If removal of the Calendar would result in
+ * Triggers pointing to non-existent calendars, then a
+ * SchedulerException will be thrown.
*
* Get the {@link Calendar} instance with the given name.
- *
* Get the names of all registered {@link Calendar}s.
- *
- * Request the interruption of all currently executing instances of the
- * identified Job, which must be an implementor of the
- * InterruptableJob interface.
- *
Job, which
+ * must be an implementor of the InterruptableJob interface.
*
* * If more than one instance of the identified job is currently executing, @@ -780,198 +882,73 @@ *
* *
- * If you wish to interrupt a specific instance of a job (when more than
- * one is executing) you can do so by calling
- * {@link #getCurrentlyExecutingJobs()} to obtain a handle
- * to the job instance, and then invoke interrupt() on it
- * yourself.
+ * This method is not cluster aware. That is, it will only interrupt
+ * instances of the identified InterruptableJob currently executing in this
+ * Scheduler instance, not across the entire cluster.
*
InterruptableJob, or there is an exception while
* interrupting the job.
* @see InterruptableJob#interrupt()
* @see #getCurrentlyExecutingJobs()
+ * @see #interrupt(String)
*/
- public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException;
+ boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException;
- ///////////////////////////////////////////////////////////////////////////
- ///
- /// Listener-related Methods
- ///
- ///////////////////////////////////////////////////////////////////////////
-
/**
- *
- * Add the given {@link JobListener} to the Scheduler's
- * global list.
- *
Job instance, which
+ * must be an implementor of the InterruptableJob interface.
*
*
- * Listeners in the 'global' list receive notification of execution events
- * for ALL {@link org.quartz.JobDetail}s.
+ * This method is not cluster aware. That is, it will only interrupt
+ * instances of the identified InterruptableJob currently executing in this
+ * Scheduler instance, not across the entire cluster.
*
- * Add the given {@link JobListener} to the Scheduler's
- * list, of registered JobListeners.
- */
- public void addJobListener(JobListener jobListener)
- throws SchedulerException;
-
- /**
- *
- * Remove the given {@link JobListener} from the Scheduler's
- * list of global listeners.
- *
InterruptableJob, or there is an exception while
+ * interrupting the job.
+ * @see InterruptableJob#interrupt()
+ * @see #getCurrentlyExecutingJobs()
+ * @see JobExecutionContext#getFireInstanceId()
+ * @see #interrupt(JobKey)
*/
- public boolean removeGlobalJobListener(JobListener jobListener)
- throws SchedulerException;
-
+ boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException;
+
/**
- *
- * Remove the identifed {@link JobListener} from the Scheduler's
- * list of registered listeners.
- *
- * Get a List containing all of the {@link JobListener} s in
- * the Scheduler'sglobal list.
- *
- * Get a Set containing the names of all the non-global{@link JobListener}
- * s registered with the Scheduler.
- *
- * Get the non-global{@link JobListener} that has
- * the given name.
- *
- * Add the given {@link TriggerListener} to the Scheduler's
- * global list.
- *
- * Listeners in the 'global' list receive notification of execution events
- * for ALL {@link Trigger}s.
- *
- * Add the given {@link TriggerListener} to the Scheduler's
- * list, of registered TriggerListeners.
- */
- public void addTriggerListener(TriggerListener triggerListener)
- throws SchedulerException;
-
- /**
- *
- * Remove the given {@link TriggerListener} from the Scheduler's
- * list of global listeners.
- *
- * Remove the identifed {@link TriggerListener} from the
- * Scheduler's list of registered listeners.
- *
- * Get a List containing all of the {@link TriggerListener}
- * s in the Scheduler'sglobal list.
- *
- * Get a Set containing the names of all the non-global{@link TriggerListener}
- * s registered with the Scheduler.
- *
- * Get the non-global{@link TriggerListener} that
- * has the given name.
- *
- * Register the given {@link SchedulerListener} with the
- * Scheduler.
- *
- * Remove the given {@link SchedulerListener} from the
- * Scheduler.
- *
- * Get a List containing all of the {@link SchedulerListener}
- * s registered with the Scheduler.
- *
* An exception that is thrown to indicate that there is a misconfiguration of
* the SchedulerFactory- or one of the components it
* configures.
- *
* Holds context/environment data that can be made available to Jobs as they * are executed. This feature is much like the ServletContext feature when * working with J2EE servlets. - *
* + *
+ * Future versions of Quartz may make distinctions on how it propagates
+ * data in SchedulerContext between instances of proxies to a
+ * single scheduler instance - i.e. if Quartz is being used via RMI.
+ *
- * Create an empty JobDataMap.
- *
SchedulerContext.
*/
public SchedulerContext() {
super(15);
}
/**
- *
- * Create a JobDataMap with the given data.
- *
SchedulerContext with the given data.
*/
- public SchedulerContext(Map map) {
+ public SchedulerContext(Map, ?> map) {
this();
-
- putAll(map);
+ @SuppressWarnings("unchecked") // param must be a String key map.
+ Map
- * Tell the SchedulerContext that it should allow non-
- * Serializable data.
- *
- * Future versions of Quartz may make distinctions on how it propogates - * data in the SchedulerContext between instances of proxies to a single - * scheduler instance - i.e. if Quartz is being used via RMI. - *
- */ - public void setAllowsTransientData(boolean allowsTransientData) { - - if (containsTransientData() && !allowsTransientData) - throw new IllegalStateException( - "Cannot set property 'allowsTransientData' to 'false' " - + "when data map contains non-serializable objects."); - - this.allowsTransientData = allowsTransientData; - } - - public boolean getAllowsTransientData() { - return allowsTransientData; - } - - public boolean containsTransientData() { - - if (!getAllowsTransientData()) // short circuit... - return false; - - String[] keys = getKeys(); - - for (int i = 0; i < keys.length; i++) { - Object o = super.get(keys[i]); - if (!(o instanceof Serializable)) return true; - } - - return false; - } - - /** - *- * Nulls-out any data values that are non-Serializable. - *
- */ - public void removeTransientData() { - - if (!getAllowsTransientData()) // short circuit... - return; - - String[] keys = getKeys(); - - for (int i = 0; i < keys.length; i++) { - Object o = super.get(keys[i]); - if (!(o instanceof Serializable)) remove(keys[i]); - } - - } - - /** - *
- * Adds the name-value pairs in the given Map to the SchedulerContext.
- *
- * All keys must be Strings.
- *
- * Adds the given int value to the SchedulerContext.
- *
- * Adds the given long value to the SchedulerContext.
- *
- * Adds the given float value to the SchedulerContext.
- *
- * Adds the given double value to the SchedulerContext.
- *
- * Adds the given boolean value to the SchedulerContext.
- *
- * Adds the given char value to the SchedulerContext.
- *
- * Adds the given String value to the SchedulerContext.
- *
- * Adds the given Object value to the SchedulerContext.
- *
- * Retrieve the identified int value from the SchedulerContext.
- *
- * Retrieve the identified long value from the SchedulerContext.
- *
- * Retrieve the identified float value from the SchedulerContext.
- *
- * Retrieve the identified double value from the SchedulerContext.
- *
- * Retrieve the identified boolean value from the SchedulerContext.
- *
- * Retrieve the identified char value from the SchedulerContext.
- *
- * Retrieve the identified String value from the SchedulerContext.
- *
* Base class for exceptions thrown by the Quartz {@link Scheduler}.
- *
- * SchedulerException s may contain a reference to another
+ * SchedulerExceptions may contain a reference to another
* Exception, which was the underlying cause of the SchedulerException.
*
- * Get the error code associated with this exception. - *
- * - *- * This may be used to find more detail about the cause of the error. - *
- * - * @return one of the ERR_XXX constants defined in this class. - */ - public int getErrorCode() { - return errorCode; - } - - /** - *- * Get the error code associated with this exception. - *
- * - *- * This may be used to provide more detail about the cause of the error. - *
- * - * @param errorCode - * one of the ERR_XXX constants defined in this class. - */ - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - /** - *
- * Determine if the specified error code is in the 'ERR_PERSISTENCE'
- * category of errors.
- *
- * Determine if the specified error code is in the 'ERR_THREAD_POOL'
- * category of errors.
- *
- * Determine if the specified error code is in the 'ERR_JOB_LISTENER'
- * category of errors.
- *
- * Determine if the specified error code is in the 'ERR_TRIGGER_LISTENER'
- * category of errors.
- *
- * Determine if the specified error code is in the 'ERR_CLIENT_ERROR'
- * category of errors.
- *
- * Determine if the specified error code is in the 'ERR_CLIENT_ERROR'
- * category of errors.
- *
- * Print a stack trace to the standard error stream. - *
- * - *- * This overridden version will print the nested stack trace if available, - * otherwise it prints only this exception's stack. - *
- */ - public void printStackTrace() { - printStackTrace(System.err); - } - - /** - *- * Print a stack trace to the specified stream. - *
- * - *- * This overridden version will print the nested stack trace if available, - * otherwise it prints only this exception's stack. - *
- * - * @param out - * the stream to which the stack traces will be printed. - */ - public void printStackTrace(PrintStream out) { - super.printStackTrace(out); - if ((cause != null)) { - synchronized (out) { - out - .println("* Nested Exception (Underlying Cause) ---------------"); - cause.printStackTrace(out); - } + Throwable cause = getUnderlyingException(); + if (cause == null || cause == this) { + return super.toString(); + } else { + return super.toString() + " [See nested exception: " + cause + "]"; } } - /** - *- * Print a stack trace to the specified writer. - *
- * - *- * This overridden version will print the nested stack trace if available, - * otherwise it prints this exception's stack. - *
- * - * @param out - * the writer to which the stack traces will be printed. - */ - public void printStackTrace(PrintWriter out) { - super.printStackTrace(out); - if ((cause != null)) { - synchronized (out) { - out - .println("* Nested Exception (Underlying Cause) ---------------"); - cause.printStackTrace(out); - } - } - } } Index: 3rdParty_sources/quartz/org/quartz/SchedulerFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/SchedulerFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/SchedulerFactory.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/SchedulerFactory.java 15 Dec 2014 10:09:46 -0000 1.1.2.1 @@ -1,6 +1,6 @@ /* - * Copyright 2004-2005 OpenSymphony + * Copyright 2001-2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -16,18 +16,13 @@ * */ -/* - * Previously Copyright (c) 2001-2004 James House - */ package org.quartz; import java.util.Collection; /** - *
* Provides a mechanism for obtaining client-usable handles to Scheduler
* instances.
- *
Scheduler.
*/
- public Scheduler getScheduler() throws SchedulerException;
+ Scheduler getScheduler() throws SchedulerException;
/**
* * Returns a handle to the Scheduler with the given name, if it exists. *
*/ - public Scheduler getScheduler(String schedName) throws SchedulerException; + Scheduler getScheduler(String schedName) throws SchedulerException; /** ** Returns handles to all known Schedulers (made by any SchedulerFactory * within this jvm.). *
*/ - public Collection getAllSchedulers() throws SchedulerException; + Collection
* The interface to be implemented by classes that want to be informed of major
* {@link Scheduler} events.
- *
* Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
* is unscheduled.
*
* Called by the {@link Scheduler} when a {@link Trigger}
* has reached the condition in which it will never fire again.
*
* Called by the {@link Scheduler} when a {@link Trigger}
- * or group of {@link Trigger}s has been paused.
+ * has been paused.
*
- * If a group was paused, then the triggerName parameter
- * will be null.
+ * Called by the {@link Scheduler} when a
+ * group of {@link Trigger}s has been paused.
*
If all groups were paused then triggerGroup will be null
+ * + * @param triggerGroup the paused group, or null if all were paused */ - public void triggersPaused(String triggerName, String triggerGroup); - + void triggersPaused(String triggerGroup); + /** *
* Called by the {@link Scheduler} when a {@link Trigger}
- * or group of {@link Trigger}s has been un-paused.
+ * has been un-paused.
*
- * If a group was resumed, then the triggerName parameter
- * will be null.
+ * Called by the {@link Scheduler} when a
+ * group of {@link Trigger}s has been un-paused.
*
* Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
- * or group of {@link org.quartz.JobDetail}s has been
- * paused.
+ * has been added.
*
- * If a group was paused, then the jobName parameter will be
- * null. If all jobs were paused, then both parameters will be null.
+ * Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
+ * has been deleted.
*
* Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
- * or group of {@link org.quartz.JobDetail}s has been
- * un-paused.
+ * has been paused.
*
+ * Called by the {@link Scheduler} when a
+ * group of {@link org.quartz.JobDetail}s has been paused.
+ *
- * If a group was resumed, then the jobName parameter will
- * be null. If all jobs were paused, then both parameters will be null.
+ * Called by the {@link Scheduler} when a {@link org.quartz.JobDetail}
+ * has been un-paused.
*
+ * Called by the {@link Scheduler} when a
+ * group of {@link org.quartz.JobDetail}s has been un-paused.
+ *
* Called by the {@link Scheduler} when a serious error has
- * occured within the scheduler - such as repeated failures in the JobStore,
+ * occurred within the scheduler - such as repeated failures in the JobStore,
* or the inability to instantiate a Job instance when its
* Trigger has fired.
*
* Called by the {@link Scheduler} to inform the listener
+ * that it has move to standby mode.
+ *
+ * Called by the {@link Scheduler} to inform the listener
+ * that it has started.
+ *
+ * Called by the {@link Scheduler} to inform the listener
+ * that it is starting.
+ *
+ * Called by the {@link Scheduler} to inform the listener
* that it has shutdown.
*
+ * Called by the {@link Scheduler} to inform the listener
+ * that it has begun the shutdown sequence.
+ *
{@link Scheduler} to inform the listener
+ * that all jobs, triggers and calendars were deleted.
+ */
+ void schedulingDataCleared();
}
Index: 3rdParty_sources/quartz/org/quartz/SchedulerMetaData.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/SchedulerMetaData.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/SchedulerMetaData.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/SchedulerMetaData.java 15 Dec 2014 10:09:46 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,22 +16,19 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
import java.util.Date;
/**
- *
* Describes the settings and capabilities of a given {@link Scheduler}
* instance.
- *
Scheduler instance.
*
*/
- public Class getSchedulerClass() {
+ public Class> getSchedulerClass() {
return schedClass;
}
@@ -140,17 +140,17 @@
*
* @return null if the scheduler has not been started.
*/
- public Date runningSince() {
+ public Date getRunningSince() {
return startTime;
}
-
+
/**
*
* Returns the number of jobs executed since the Scheduler
* started..
*
* Note: isStarted() may return true even if
- * isPaused() returns true.
+ * isInStandbyMode() returns true.
*
- * Reports whether the Scheduler is paused.
- *
- * Note: isStarted() may return true even if
- * isPaused() returns true.
- *
Scheduler is in standby mode.
*/
- public boolean isPaused() {
- return paused;
+ public boolean isInStandbyMode() {
+ return isInStandbyMode;
}
/**
@@ -207,27 +200,37 @@
* being used by the Scheduler.
*
*/
- public Class getJobStoreClass() {
+ public Class> getJobStoreClass() {
return jsClass;
}
-
+
/**
*
* Returns whether or not the Scheduler'sJobStore
* instance supports persistence.
*
+ * Returns whether or not the Scheduler'sJobStore
+ * is clustered.
+ *
* Returns the class-name of the ThreadPool instance that is
* being used by the Scheduler.
*
- * A concrete {@link Trigger} that is used to fire a {@link org.quartz.JobDetail}
+ * A {@link Trigger} that is used to fire a Job
* at a given moment in time, and optionally repeated at a specified interval.
- *
* Instructs the {@link Scheduler} that upon a mis-fire
@@ -62,13 +46,15 @@
*
* Instructs the {@link Scheduler} that upon a mis-fire
* situation, the {@link SimpleTrigger} wants to be
* re-scheduled to 'now' (even if the associated {@link Calendar}
- * excludes 'now') with the repeat count left as-is.
+ * excludes 'now') with the repeat count left as-is. This does obey the
+ * Trigger end-time however, so if 'now' is after the
+ * end-time the Trigger will not fire again.
*
@@ -77,29 +63,27 @@ * is only an issue if you for some reason wanted to be able to tell what * the original values were at some later time). *
- * - *
- * NOTE: This instruction could cause the Trigger
- * to go to the 'COMPLETE' state after firing 'now', if all the
- * repeat-fire-times where missed.
- *
* Instructs the {@link Scheduler} that upon a mis-fire
* situation, the {@link SimpleTrigger} wants to be
* re-scheduled to 'now' (even if the associated {@link Calendar}
* excludes 'now') with the repeat count set to what it would be, if it had
- * not missed any firings.
+ * not missed any firings. This does obey the Trigger end-time
+ * however, so if 'now' is after the end-time the Trigger will
+ * not fire again.
*
* NOTE: Use of this instruction causes the trigger to 'forget' - * the start-time and repeat-count that it was originally setup with (this - * is only an issue if you for some reason wanted to be able to tell what - * the original values were at some later time). + * the start-time and repeat-count that it was originally setup with. + * Instead, the repeat count on the trigger will be changed to whatever + * the remaining repeat count is (this is only an issue if you for some + * reason wanted to be able to tell what the original values were at some + * later time). *
* *@@ -109,7 +93,7 @@ *
*/ public static final int MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT = 3; - + /** *
* Instructs the {@link Scheduler} that upon a mis-fire
@@ -125,7 +109,7 @@
*
* Instructs the {@link Scheduler} that upon a mis-fire
@@ -136,705 +120,45 @@
*
- * NOTE: Use of this instruction causes the trigger to 'forget' - * the repeat-count that it was originally setup with (this is only an - * issue if you for some reason wanted to be able to tell what the original - * values were at some later time). - *
- * - *
* NOTE/WARNING: This instruction could cause the Trigger
- * to go directly to the 'COMPLETE' state if all fire-times where missed.
+ * to go directly to the 'COMPLETE' state if the end-time of the trigger
+ * has arrived.
*
* Used to indicate the 'repeat count' of the trigger is indefinite. Or in * other words, the trigger should repeat continually until the trigger's * ending timestamp. *
*/ - public static int REPEAT_INDEFINITELY = -1; + public static final int REPEAT_INDEFINITELY = -1; - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Data members. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - private Date startTime = null; - - private Date endTime = null; - - private Date nextFireTime = null; - - private Date previousFireTime = null; - - private int repeatCount = 0; - - private long repeatInterval = 0; - - private int timesTriggered = 0; - - private boolean complete = false; - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Constructors. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - /** *
- * Create a SimpleTrigger with no settings.
- *
- * Create a SimpleTrigger that will occur immediately, and
- * not repeat.
- *
- * Create a SimpleTrigger that will occur immediately, and
- * repeat at the the given interval the given number of times.
- *
- * Create a SimpleTrigger that will occur at the given time,
- * and not repeat.
- *
- * Create a SimpleTrigger that will occur at the given time,
- * and repeat at the the given interval the given number of times, or until
- * the given end time.
- *
Date set to the time for the Trigger
- * to fire.
- * @param endTime
- * A Date set to the time for the Trigger
- * to quit repeat firing.
- * @param repeatCount
- * The number of times for the Trigger to repeat
- * firing, use {@link #REPEAT_INDEFINITELY}for unlimitted times.
- * @param repeatInterval
- * The number of milliseconds to pause between the repeat firing.
- */
- public SimpleTrigger(String name, String group, Date startTime,
- Date endTime, int repeatCount, long repeatInterval) {
- super(name, group);
-
- setStartTime(startTime);
- setEndTime(endTime);
- setRepeatCount(repeatCount);
- setRepeatInterval(repeatInterval);
- }
-
- /**
- *
- * Create a SimpleTrigger that will occur at the given time,
- * fire the identified Job and repeat at the the given
- * interval the given number of times, or until the given end time.
- *
Date set to the time for the Trigger
- * to fire.
- * @param endTime
- * A Date set to the time for the Trigger
- * to quit repeat firing.
- * @param repeatCount
- * The number of times for the Trigger to repeat
- * firing, use {@link #REPEAT_INDEFINITELY}for unlimitted times.
- * @param repeatInterval
- * The number of milliseconds to pause between the repeat firing.
- */
- public SimpleTrigger(String name, String group, String jobName,
- String jobGroup, Date startTime, Date endTime, int repeatCount,
- long repeatInterval) {
- super(name, group, jobName, jobGroup);
-
- setStartTime(startTime);
- setEndTime(endTime);
- setRepeatCount(repeatCount);
- setRepeatInterval(repeatInterval);
- }
-
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Interface.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
- /**
- *
- * Get the time at which the SimpleTrigger should occur.
- *
- * Set the time at which the SimpleTrigger should occur.
- *
null.
- */
- public void setStartTime(Date startTime) {
- if (startTime == null)
- throw new IllegalArgumentException("Start time cannot be null");
-
- Date eTime = getEndTime();
- if (eTime != null && startTime != null && eTime.before(startTime))
- throw new IllegalArgumentException(
- "End time cannot be before start time");
-
- this.startTime = startTime;
- }
-
- /**
- *
- * Get the time at which the SimpleTrigger should quit
- * repeating - even if repeastCount isn't yet satisfied.
- *
- * Set the time at which the SimpleTrigger should quit
- * repeating (and be automatically deleted).
- *
* Get the the number of times the SimpleTrigger should
* repeat, after which it will be automatically deleted.
*
- * Set the the number of time the SimpleTrigger should
- * repeat, after which it will be automatically deleted.
+ * Get the the time interval (in milliseconds) at which the SimpleTrigger should repeat.
*
- * Get the the time interval (in milliseconds) at which the SimpleTrigger
- * should repeat.
+ * Get the number of times the SimpleTrigger has already fired.
*
- * Set the the time interval (in milliseconds) at which the SimpleTrigger
- * should repeat.
- *
- * Get the number of times the SimpleTrigger has already
- * fired.
- *
- * Set the number of times the SimpleTrigger has already
- * fired.
- *
- * Updates the SimpleTrigger's state based on the
- * MISFIRE_INSTRUCTION_XXX that was selected when the SimpleTrigger
- * was created.
- *
- * If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY,
- * then the following scheme will be used:
- *
0, then the instruction will
- * be interpreted as MISFIRE_INSTRUCTION_FIRE_NOW.REPEAT_INDEFINITELY, then
- * the instruction will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT.
- * WARNING: using MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
- * with a trigger that has a non-null end-time may cause the trigger to
- * never fire again if the end-time arrived during the misfire time span.
- * > 0, then the instruction
- * will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT.
- *
- * Called when the {@link Scheduler} has decided to 'fire'
- * the trigger (execute the associated Job), in order to
- * give the Trigger a chance to update itself for its next
- * triggering (if any).
- *
- * Called by the scheduler at the time a Trigger is first
- * added to the scheduler, in order to have the Trigger
- * compute its first fire time, based on any associated calendar.
- *
- * After this method has been called, getNextFireTime()
- * should return a valid answer.
- *
Trigger will be fired
- * by the scheduler, which is also the same value getNextFireTime()
- * will return (until after the first firing of the Trigger).
- *
- */
- public Date computeFirstFireTime(Calendar calendar) {
- nextFireTime = getStartTime();
-
- while (nextFireTime != null && calendar != null
- && !calendar.isTimeIncluded(nextFireTime.getTime())) {
- nextFireTime = getFireTimeAfter(nextFireTime);
- }
-
- return nextFireTime;
- }
-
- /**
- *
- * Called after the {@link Scheduler} has executed the
- * {@link org.quartz.JobDetail} associated with the Trigger
- * in order to get the final instruction code from the trigger.
- *
JobExecutionContext that was used by the
- * Job'sexecute(xx) method.
- * @param result
- * is the JobExecutionException thrown by the
- * Job, if any (may be null).
- * @return one of the Trigger.INSTRUCTION_XXX constants.
- *
- * @see #INSTRUCTION_NOOP
- * @see #INSTRUCTION_RE_EXECUTE_JOB
- * @see #INSTRUCTION_DELETE_TRIGGER
- * @see #INSTRUCTION_SET_TRIGGER_COMPLETE
- * @see #triggered(Calendar)
- */
- public int executionComplete(JobExecutionContext context,
- JobExecutionException result) {
- if (result != null && result.refireImmediately())
- return INSTRUCTION_RE_EXECUTE_JOB;
-
- if (result != null && result.unscheduleFiringTrigger())
- return INSTRUCTION_SET_TRIGGER_COMPLETE;
-
- if (result != null && result.unscheduleAllTriggers())
- return INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE;
-
- if (!mayFireAgain()) return INSTRUCTION_DELETE_TRIGGER;
-
- return INSTRUCTION_NOOP;
- }
-
- /**
- *
- * Returns the next time at which the SimpleTrigger will
- * fire. If the trigger will not fire again, null will be
- * returned. The value returned is not guaranteed to be valid until after
- * the Trigger has been added to the scheduler.
- *
- * Returns the previous time at which the SimpleTrigger will
- * fire. If the trigger has not yet fired, null will be
- * returned.
- */
- public Date getPreviousFireTime() {
- return previousFireTime;
- }
-
- /**
- *
- * Set the next time at which the SimpleTrigger should fire.
- *
- * This method should not be invoked by client code. - *
- */ - public void setNextFireTime(Date nextFireTime) { - this.nextFireTime = nextFireTime; - } - - /** - *
- * Set the previous time at which the SimpleTrigger fired.
- *
- * This method should not be invoked by client code. - *
- */ - public void setPreviousFireTime(Date previousFireTime) { - this.previousFireTime = previousFireTime; - } - - /** - *
- * Returns the next time at which the SimpleTrigger will
- * fire, after the given time. If the trigger will not fire after the given
- * time, null will be returned.
- *
- * Returns the last time at which the SimpleTrigger will
- * fire, before the given time. If the trigger will not fire before the
- * given time, null will be returned.
- *
- * Returns the final time at which the SimpleTrigger will
- * fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned.
- *
- * Note that the return time may be in the past. - *
- */ - public Date getFinalFireTime() { - if (repeatCount == 0) return startTime; - - if (repeatCount == REPEAT_INDEFINITELY && getEndTime() == null) - return null; - - if (repeatCount == REPEAT_INDEFINITELY && getEndTime() == null) return null; - else if (repeatCount == REPEAT_INDEFINITELY) - return getFireTimeBefore(getEndTime()); - - long lastTrigger = startTime.getTime() + (repeatCount * repeatInterval); - - if ((getEndTime() == null) || (lastTrigger < getEndTime().getTime())) return new Date( - lastTrigger); - else - return getFireTimeBefore(getEndTime()); - } - - /** - *
- * Determines whether or not the SimpleTrigger will occur
- * again.
- *
- * Validates whether the properties of the
* A marker interface for
*
- * The base abstract class to be extended by all
- *
- *
* Triggers can 'send' parameters/data to
- * Instructs the
- * Instructs the
- * Instructs the
- * Instructs the
- * Instructs the
- * Instructs the
- * Instructs the
* Instructs the
* In order to see if this instruction fits your needs, you should look at
@@ -144,788 +103,227 @@
*
- * Indicates that the
- * Indicates that the
- * Indicates that the
- * "Complete" indicates that the trigger has not remaining fire-times in
- * its schedule.
- * NOTE: if a trigger uses this instruction, and it has missed
+ * several of its scheduled firings, then several rapid firings may occur
+ * as the trigger attempt to catch back up to where it would have been.
+ * For example, a SimpleTrigger that fires every 15 seconds which has
+ * misfired for 5 minutes will fire 20 times once it gets the chance to
+ * fire.
- * Indicates that the
- * A
- * When the trigger is in the error state, the scheduler will make no
- * attempts to fire it.
- *
- * Indicates that the
- * A
- * Indicates that the
- * Create a
- * Note that the {@link #setName(String)},{@link #setGroup(String)}and
- * the {@link #setJobName(String)}and {@link #setJobGroup(String)}methods
- * must be called before the
- * Create a
- * Note that the {@link #setJobName(String)}and
- * {@link #setJobGroup(String)}methods must be called before the
- * Create a
- * Get the name of this
- * Set the name of this
- * Get the group of this
- * Set the name of this
- * Get the name of the associated
- * Set the name of the associated
- * Get the name of the associated
- * Set the name of the associated
- * Returns the 'full name' of the
- * Returns the 'full name' of the
* Return the description given to the
- * Set a description for the
- * Set whether or not the
- * Associate the
* Get the name of the
* Get the
* Changes made to this map during job execution are not re-persisted, and
* in fact typically result in an
- * Set the
- * Whether or not the
- * If not explicitly set, the default value is
- * Add the specified name of a
- * Remove the specified name of a
- * Returns an array of
- * This method should not be used by the Quartz client.
- *
- * Called when the
- * This method should not be used by the Quartz client.
- *
- * Called by the scheduler at the time a
- * After this method has been called, JobDetail are
- * valid for submission into a Scheduler.
- *
- * @throws IllegalStateException
- * if a required property (such as Name, Group, Class) is not
- * set.
- */
- public void validate() throws SchedulerException {
- super.validate();
-
- if (repeatCount != 0 && repeatInterval < 1)
- throw new SchedulerException("Repeat Interval cannot be zero.",
- SchedulerException.ERR_CLIENT_ERROR);
- }
-
- public static void main(String[] args) // TODO: remove method after good
- // unit testing
- throws Exception {
-
- Date sdt = new Date();
-
- Date edt = new Date(sdt.getTime() + 55000L);
-
- SimpleTrigger st = new SimpleTrigger("t", "g", "j", "g", sdt, edt, 10,
- 10000L);
-
- System.err.println();
-
- st.computeFirstFireTime(null);
-
- System.err.println("lastTime=" + st.getFinalFireTime());
-
- java.util.List times = TriggerUtils.computeFireTimes(st, null, 50);
-
- for (int i = 0; i < times.size(); i++) {
- System.err.println("firetime = " + times.get(i));
- }
- }
-
+ TriggerBuilder{@link org.quartz.JobDetail} s that
* wish to have their state maintained between executions.
- * StatefulJob instances follow slightly different rules from
@@ -37,13 +32,21 @@
* the execute(xx) method will be delayed.
* Triggers.
- * Triggers -
+ * use {@link TriggerBuilder} to instantiate an actual Trigger.
*
* Triggers s have a name and group associated with them, which
+ * Triggerss have a {@link TriggerKey} associated with them, which
* should uniquely identify them within a single {@link Scheduler}.
* Triggers are the 'mechanism' by which Job s
- * are scheduled. Many Trigger s can point to the same Job,
+ * Triggers are the 'mechanism' by which Jobs
+ * are scheduled. Many Triggers can point to the same Job,
* but a single Trigger can only point to one Job.
* Jobs by placing contents
* into the JobDataMap on the Trigger.
* NOOP Instructs the {@link Scheduler} that the
+ * {@link Trigger} has no further instructions.RE_EXECUTE_JOB Instructs the {@link Scheduler} that the
+ * {@link Trigger} wants the {@link org.quartz.JobDetail} to
+ * re-execute immediately. If not in a 'RECOVERING' or 'FAILED_OVER' situation, the
+ * execution context will be re-used (giving the Job the
+ * ability to 'see' anything placed in the context by its last execution).SET_TRIGGER_COMPLETE Instructs the {@link Scheduler} that the
+ * {@link Trigger} should be put in the COMPLETE state.DELETE_TRIGGER Instructs the {@link Scheduler} that the
+ * {@link Trigger} wants itself deleted.SET_ALL_JOB_TRIGGERS_COMPLETE Instructs the {@link Scheduler}
+ * that all Triggers referencing the same {@link org.quartz.JobDetail}
+ * as this one should be put in the COMPLETE state.SET_TRIGGER_ERROR Instructs the {@link Scheduler} that all
+ * Triggers referencing the same {@link org.quartz.JobDetail} as
+ * this one should be put in the ERROR state.SET_ALL_JOB_TRIGGERS_ERROR Instructs the {@link Scheduler} that
+ * the Trigger should be put in the ERROR state.{@link Scheduler} that the {@link Trigger}
- * has no further instructions.
- * {@link Scheduler} that the {@link Trigger}
- * wants the {@link org.quartz.JobDetail} to re-execute
- * immediately. If not in a 'RECOVERING' or 'FAILED_OVER' situation, the
- * execution context will be re-used (giving the Job the
- * abilitiy to 'see' anything placed in the context by its last execution).
- * {@link Scheduler} that the {@link Trigger}
- * should be put in the COMPLETE state.
- * {@link Scheduler} that the {@link Trigger}
- * wants itself deleted.
- * {@link Scheduler} that all Trigger
- * s referencing the same {@link org.quartz.JobDetail} as
- * this one should be put in the COMPLETE state.
- * {@link Scheduler} that all Trigger
- * s referencing the same {@link org.quartz.JobDetail} as
- * this one should be put in the ERROR state.
- * {@link Scheduler} that the Trigger
- * should be put in the ERROR state.
- * {@link Scheduler} that upon a mis-fire
* situation, the updateAfterMisfire() method will be called
- * on the Trigger to determine the mis-fire instruction.
- * Trigger to determine the mis-fire instruction,
+ * which logic will be trigger-implementation-dependent.
*
* Trigger is in the "normal" state.
- * Trigger is in the "paused" state.
- * Trigger is in the "complete" state.
- * {@link Scheduler} that the
+ * Trigger will never be evaluated for a misfire situation,
+ * and that the scheduler will simply try to fire it as soon as it can,
+ * and then update the Trigger as if it had fired at the proper time.
*
- * Trigger is in the "error" state.
- * Trigger arrives at the error state when the scheduler
- * attempts to fire it, but cannot due to an error creating and executing
- * its related job. Often this is due to the Job's
- * class not existing in the classpath.
- * Trigger is in the "blocked" state.
- * Trigger arrives at the blocked state when the job that
- * it is associated with is a StatefulJob and it is
- * currently executing.
- * Trigger does not exist.
- * Trigger with no specified name, group, or {@link org.quartz.JobDetail}.
- * Trigger can be placed into a
- * {@link Scheduler}.
- * Trigger with the given name, and group.
- * Trigger
- * can be placed into a {@link Scheduler}.
- * null, 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);
- }
-
- /**
- * Trigger with the given name, and group.
- * null, 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);
- }
-
- /*
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Interface.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
- /**
- * Trigger.
- * Trigger.
- * Trigger.
- * Trigger.
- * null, Scheduler.DEFAULT_GROUP will be used.
- *
- * @exception IllegalArgumentException
- * if group is an empty string.
- */
- public void setGroup(String group) {
- if (group != null && group.trim().length() == 0)
- throw new IllegalArgumentException(
- "Group name cannot be an empty string.");
-
- if(group == null)
- group = Scheduler.DEFAULT_GROUP;
-
- this.group = group;
- }
-
- /**
- * {@link org.quartz.JobDetail}.
- * {@link org.quartz.JobDetail}.
- * {@link org.quartz.JobDetail}'s
- * group.
- * {@link org.quartz.JobDetail}'s
- * group.
- * null, Scheduler.DEFAULT_GROUP will be used.
- *
- * @exception IllegalArgumentException
- * if group is an empty string.
- */
- public void setJobGroup(String jobGroup) {
- if (jobGroup != null && jobGroup.trim().length() == 0)
- throw new IllegalArgumentException(
- "Group name cannot be null or empty.");
-
- if(jobGroup == null)
- jobGroup = Scheduler.DEFAULT_GROUP;
-
- this.jobGroup = jobGroup;
- }
-
- /**
- * Trigger in the format
- * "group.name".
- * Job that the Trigger
- * points to, in the format "group.name".
- * Trigger instance by
* its creator (if any).
- * Trigger instance - may be
- * useful for remembering/displaying the purpose of the trigger, though the
- * description has no meaning to Quartz.
- * Trigger should be persisted in the
- * {@link org.quartz.spi.JobStore} for re-use after program
- * restarts.
- * {@link Calendar} with the given name with
- * this Trigger.
- * null to dis-associate a Calendar.
- */
- public void setCalendarName(String calendarName) {
- this.calendarName = calendarName;
- }
-
- /**
- * {@link Calendar} associated with this
* Trigger.
- * null if there is no associated Calendar.
*/
- public String getCalendarName() {
- return calendarName;
- }
+ public String getCalendarName();
/**
- * JobDataMap that is associated with the
* Trigger.
- * IllegalStateException.
* JobDataMap to be associated with the
- * Trigger.
- * Trigger should be persisted in the
- * {@link org.quartz.spi.JobStore} for re-use after program
- * restarts.
- * Trigger acts as a tiebreaker such that if
+ * two Triggers have the same scheduled fire time, then the
+ * one with the higher priority will get first access to a worker
+ * thread.
*
* false.
+ * If not explicitly set, the default value is 5.
* true if the Trigger should be
- * garbage collected along with the {@link Scheduler}.
+ * @see #DEFAULT_PRIORITY
*/
- public boolean isVolatile() {
- return volatility;
- }
+ public int getPriority();
/**
- * {@link TriggerListener} to
- * the end of the Trigger's list of listeners.
- * {@link TriggerListener}
- * from the Trigger's list of listeners.
- * String s containing the names of all
- * {@link TriggerListener} assigned to the Trigger,
- * in the order in which they should be notified.
- * {@link Scheduler} has decided to 'fire'
- * the trigger (execute the associated Job), in order to
- * give the Trigger a chance to update itself for its next
- * triggering (if any).
- * Trigger is first
- * added to the scheduler, in order to have the Trigger
- * compute its first fire time, based on any associated calendar.
- * getNextFireTime()
- * should return a valid answer.
- * Trigger will be fired
- * by the scheduler, which is also the same value getNextFireTime()
- * will return (until after the first firing of the Trigger).
- *
- * This method should not be used by the Quartz client. - *
- * - *
- * Called after the {@link Scheduler} has executed the
- * {@link org.quartz.JobDetail} associated with the Trigger
- * in order to get the final instruction code from the trigger.
- *
JobExecutionContext that was used by the
- * Job'sexecute(xx) method.
- * @param result
- * is the JobExecutionException thrown by the
- * Job, if any (may be null).
- * @return one of the Trigger.INSTRUCTION_XXX constants.
- *
- * @see #INSTRUCTION_NOOP
- * @see #INSTRUCTION_RE_EXECUTE_JOB
- * @see #INSTRUCTION_DELETE_TRIGGER
- * @see #INSTRUCTION_SET_TRIGGER_COMPLETE
- * @see #triggered(Calendar)
- */
- public abstract int executionComplete(JobExecutionContext context,
- JobExecutionException result);
-
- /**
- *
* Used by the {@link Scheduler} to determine whether or not
* it is possible for this Trigger to fire again.
- *
* If the returned value is false then the Scheduler
* may remove the Trigger from the {@link org.quartz.spi.JobStore}.
*
* Get the time at which the Trigger should occur.
- *
* Get the time at which the Trigger should quit repeating -
- * even if an assigned 'repeatCount' isn't yet satisfied.
- *
- * Returns the next time at which the Trigger will fire. If
- * the trigger will not fire again, null will be returned.
- * The value returned is not guaranteed to be valid until after the Trigger
+ * Returns the next time at which the Trigger is scheduled to fire. If
+ * the trigger will not fire again, null will be returned. Note that
+ * the time returned can possibly be in the past, if the time that was computed
+ * for the trigger to next fire has already arrived, but the scheduler has not yet
+ * been able to fire the trigger (which would likely be due to lack of resources
+ * e.g. threads).
+ *
+ *
The value returned is not guaranteed to be valid until after the Trigger
* has been added to the scheduler.
*
- * Returns the previous time at which the Trigger will fire.
+ * Returns the previous time at which the Trigger fired.
* If the trigger has not yet fired, null will be returned.
*/
- public abstract Date getPreviousFireTime();
+ public Date getPreviousFireTime();
/**
- *
* Returns the next time at which the Trigger will fire,
* after the given time. If the trigger will not fire after the given time,
* null will be returned.
- *
* Returns the last time at which the Trigger will fire, if
* the Trigger will repeat indefinitely, null will be returned.
- *
* Note that the return time *may* be in the past. *
*/ - public abstract Date getFinalFireTime(); + public Date getFinalFireTime(); /** - *
- * Set the instruction the Scheduler should be given for
- * handling misfire situations for this Trigger- the
- * concrete Trigger type that you are using will have
- * defined a set of additional MISFIRE_INSTRUCTION_XXX
- * constants that may be passed to this method.
- *
- * If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.
- *
* Get the instruction the Scheduler should be given for
* handling misfire situations for this Trigger- the
* concrete Trigger type that you are using will have
* defined a set of additional MISFIRE_INSTRUCTION_XXX
- * constants that may be passed to this method.
- *
* If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.
*
- * This method should not be used by the Quartz client. - *
+ * Get a {@link TriggerBuilder} that is configured to produce a + *Trigger identical to this one.
*
- * - * To be implemented by the concrete classes that extend this class. - *
- * - *
- * The implementation should update the Trigger's state
- * based on the MISFIRE_INSTRUCTION_XXX that was selected when the Trigger
- * was created.
- *
- * This method should not be used by the Quartz client. - *
+ * Get a {@link ScheduleBuilder} that is configured to produce a + * schedule identical to this trigger's schedule. * - *- * To be implemented by the concrete class. - *
- * - *
- * The implementation should update the Trigger's state
- * based on the given new version of the associated Calendar
- * (the state should be updated so that it's next fire time is appropriate
- * given the Calendar's new settings).
- *
- * Validates whether the properties of the JobDetail are
- * valid for submission into a Scheduler.
+ * Trigger equality is based upon the equality of the TriggerKey.
*
- * @throws IllegalStateException
- * if a required property (such as Name, Group, Class) is not
- * set.
+ * @return true if the key of this Trigger equals that of the given Trigger.
*/
- public void validate() throws SchedulerException {
- if (name == null)
- throw new SchedulerException("Trigger's name cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
-
- if (group == null)
- throw new SchedulerException("Trigger's group cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
-
- if (jobName == null)
- throw new SchedulerException(
- "Trigger's related Job's name cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
-
- if (jobGroup == null)
- throw new SchedulerException(
- "Trigger's related Job's group cannot be null",
- SchedulerException.ERR_CLIENT_ERROR);
- }
-
+ public boolean equals(Object other);
+
/**
*
- * This method should not be used by the Quartz client.
+ * Compare the next fire time of this Trigger to that of
+ * another by comparing their keys, or in other words, sorts them
+ * according to the natural (i.e. alphabetical) order of their keys.
*
- * Usable by {@link org.quartz.spi.JobStore}
- * implementations, in order to facilitate 'recognizing' instances of fired
- * Trigger s as their jobs complete execution.
- *
- * This method should not be used by the Quartz client. - *
+ * A Comparator that compares trigger's next fire times, or in other words, + * sorts them according to earliest next fire time. If the fire times are + * the same, then the triggers are sorted according to priority (highest + * value first), if the priorities are the same, then they are sorted + * by key. */ - public String getFireInstanceId() { - return fireInstanceId; - } + class TriggerTimeComparator implements Comparator- * Return a simple string representation of this object. - *
- */ - public String toString() { - return "Trigger '" + getFullName() + "': triggerClass: '" - + getClass().getName() + " isVolatile: " + isVolatile() - + " calendar: '" + getCalendarName() + "' misfireInstruction: " - + getMisfireInstruction() + " nextFireTime: " + getNextFireTime(); - } + if (nextFireTime2 == null) { + return -1; + } - /** - *
- * Compare the next fire time of this Trigger to that of
- * another.
- *
* The interface to be implemented by classes that want to be informed when a
* {@link Trigger} fires. In general, applications that use a
* Scheduler will not have use for this mechanism.
- *
TriggerListener.
*
*/
- public String getName();
+ String getName();
/**
*
@@ -70,13 +68,14 @@
* The JobExecutionContext that will be passed to
* the Job'sexecute(xx) method.
*/
- public void triggerFired(Trigger trigger, JobExecutionContext context);
+ void triggerFired(Trigger trigger, JobExecutionContext context);
/**
*
* Called by the {@link Scheduler} when a {@link Trigger}
* has fired, and it's associated {@link org.quartz.JobDetail}
- * is about to be executed.
+ * is about to be executed. If the implementation vetos the execution (via
+ * returning true), the job's execute method will not be called.
*
@@ -90,7 +89,7 @@
* The JobExecutionContext that will be passed to
* the Job'sexecute(xx) method.
*/
- public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context);
+ boolean vetoJobExecution(Trigger trigger, JobExecutionContext context);
/**
@@ -109,7 +108,7 @@
* @param trigger
* The Trigger that has misfired.
*/
- public void triggerMisfired(Trigger trigger);
+ void triggerMisfired(Trigger trigger);
/**
*
@@ -124,11 +123,11 @@
* @param context
* The JobExecutionContext that was passed to the
* Job'sexecute(xx) method.
- * @param triggerIntructionCode
+ * @param triggerInstructionCode
* the result of the call on the Trigger'striggered(xx)
* method.
*/
- public void triggerComplete(Trigger trigger, JobExecutionContext context,
- int triggerInstructionCode);
+ void triggerComplete(Trigger trigger, JobExecutionContext context,
+ CompletedExecutionInstruction triggerInstructionCode);
}
Index: 3rdParty_sources/quartz/org/quartz/TriggerUtils.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/TriggerUtils.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/TriggerUtils.java 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/TriggerUtils.java 15 Dec 2014 10:09:46 -0000 1.1.2.1
@@ -1,6 +1,6 @@
/*
- * Copyright 2004-2005 OpenSymphony
+ * Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
@@ -16,31 +16,21 @@
*
*/
-/*
- * Previously Copyright (c) 2001-2004 James House
- */
package org.quartz;
-import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import java.util.TimeZone;
+import org.quartz.spi.OperableTrigger;
+
/**
- *
- * Convenience and utility methods for simplifying the construction and
- * configuration of {@link Trigger}s.
- *
{@link Trigger}s.
*
- * - * Please submit suggestions for additional convenience methods to either the - * Quartz user forum or the developer's mail list at - * source forge. - *
* * @see CronTrigger * @see SimpleTrigger + * @see DateBuilder * * @author James House */ @@ -54,30 +44,12 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - public static final int SUNDAY = 1; - - public static final int MONDAY = 2; - - public static final int TUESDAY = 3; - - public static final int WEDNESDAY = 4; - - public static final int THURSDAY = 5; - - public static final int FRIDAY = 6; - - public static final int SATURDAY = 7; - - public static final int LAST_DAY_OF_MONTH = -1; - - public static final long MILLISECONDS_IN_MINUTE = 60l * 1000l; - - public static final long MILLISECONDS_IN_HOUR = 60l * 60l * 1000l; - - public static final long SECONDS_IN_DAY = 24l * 60l * 60L; - - public static final long MILLISECONDS_IN_DAY = SECONDS_IN_DAY * 1000l; - + /** + * Private constructor because this is a pure utility class. + */ + private TriggerUtils() { + } + /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -86,1134 +58,48 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - private static void validateDayOfWeek(int dayOfWeek) { - if (dayOfWeek < SUNDAY || dayOfWeek > SATURDAY) - throw new IllegalArgumentException("Invalid day of week."); - } - - private static void validateHour(int hour) { - if (hour < 0 || hour > 23) - throw new IllegalArgumentException( - "Invalid hour (must be >= 0 and <= 23)."); - } - - private static void validateMinute(int minute) { - if (minute < 0 || minute > 59) - throw new IllegalArgumentException( - "Invalid minute (must be >= 0 and <= 59)."); - } - - private static void validateSecond(int second) { - if (second < 0 || second > 59) - throw new IllegalArgumentException( - "Invalid second (must be >= 0 and <= 59)."); - } - - private static void validateDayOfMonth(int day) { - if ((day < 1 || day > 31) && day != LAST_DAY_OF_MONTH) - throw new IllegalArgumentException("Invalid day of month."); - } - - private static void validateMonth(int month) { - if (month < 1 || month > 12) - throw new IllegalArgumentException( - "Invalid month (must be >= 1 and <= 12."); - } - - private static void validateYear(int year) { - if (year < 1970 || year > 2099) - throw new IllegalArgumentException( - "Invalid year (must be >= 1970 and <= 2099."); - } - /** - *
- * Set the given Trigger's name to the given value, and its
- * group to the default group (Scheduler.DEFAULT_GROUP).
- *
Trigger.
+ * 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 trig the tigger to change name to
- * @param name the new trigger name
+ * @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 void setTriggerIdentity(Trigger trig, String name) {
- setTriggerIdentity(trig, name, Scheduler.DEFAULT_GROUP);
- }
+ public static List
- * Set the given Trigger's name to the given value, and its
- * group to the given group.
- *
- * Make a trigger that will fire every day at the given time. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the new trigger - */ - public static Trigger makeDailyTrigger(int hour, int minute) { - validateHour(hour); - validateMinute(minute); - - CronTrigger trig = new CronTrigger(); - - try { - trig.setCronExpression("0 " + minute + " " + hour + " ? * *"); - } catch (Exception ignore) { - return null; /* never happens... */ + if (t.getNextFireTime() == null) { + t.computeFirstFireTime(cal); } - trig.setStartTime(new Date()); - - return trig; - } - - /** - *- * Make a trigger that will fire every day at the given time. - *
- * - *- * The generated trigger will not have its group or end-time set. - * The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the newly created trigger - */ - public static Trigger makeDailyTrigger( - String trigName, int hour, int minute) { - Trigger trig = makeDailyTrigger(hour, minute); - trig.setName(trigName); - return trig; - } - - /** - *- * Make a trigger that will fire every week at the given day and time. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param dayOfWeek (1-7) the day of week upon which to fire - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the new trigger - * - * @see #SUNDAY - * @see #MONDAY - * @see #TUESDAY - * @see #WEDNESDAY - * @see #THURSDAY - * @see #FRIDAY - * @see #SATURDAY - */ - public static Trigger makeWeeklyTrigger( - int dayOfWeek, int hour, int minute) { - validateDayOfWeek(dayOfWeek); - validateHour(hour); - validateMinute(minute); - - CronTrigger trig = new CronTrigger(); - - try { - trig.setCronExpression("0 " + minute + " " + hour + " ? * " - + dayOfWeek); - } catch (Exception ignore) { - return null; /* never happens... */ + for (int i = 0; i < numTimes; i++) { + Date d = t.getNextFireTime(); + if (d != null) { + lst.add(d); + t.triggered(cal); + } else { + break; + } } - - trig.setStartTime(new Date()); - return trig; + return java.util.Collections.unmodifiableList(lst); } - - /** - *- * Make a trigger that will fire every week at the given day and time. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param dayOfWeek (1-7) the day of week upon which to fire - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the newly created trigger - * - * @see #SUNDAY - * @see #MONDAY - * @see #TUESDAY - * @see #WEDNESDAY - * @see #THURSDAY - * @see #FRIDAY - * @see #SATURDAY - */ - public static Trigger makeWeeklyTrigger( - String trigName, int dayOfWeek, int hour, int minute) { - Trigger trig = makeWeeklyTrigger(dayOfWeek, hour, minute); - trig.setName(trigName); - return trig; - } - /** - *- * Make a trigger that will fire every month at the given day and time. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - *- * If the day of the month specified does not occur in a given month, a - * firing will not occur that month. (i.e. if dayOfMonth is specified as - * 31, no firing will occur in the months of the year with fewer than 31 - * days). - *
- * - * @param dayOfMonth (1-31, or -1) the day of week upon which to fire - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the newly created trigger - */ - public static Trigger makeMonthlyTrigger( - int dayOfMonth, int hour, int minute) { - validateDayOfMonth(dayOfMonth); - validateHour(hour); - validateMinute(minute); - - CronTrigger trig = new CronTrigger(); - - try { - if (dayOfMonth != LAST_DAY_OF_MONTH) trig.setCronExpression("0 " - + minute + " " + hour + " " + dayOfMonth + " * ?"); - else - trig.setCronExpression("0 " + minute + " " + hour + " L * ?"); - } catch (Exception ignore) { - return null; /* never happens... */ - } - - trig.setStartTime(new Date()); - - return trig; - } - - /** - *- * Make a trigger that will fire every month at the given day and time. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - *- * If the day of the month specified does not occur in a given month, a - * firing will not occur that month. (i.e. if dayOfMonth is specified as - * 31, no firing will occur in the months of the year with fewer than 31 - * days). - *
- * - * @param trigName the trigger's name - * @param dayOfMonth (1-31, or -1) the day of week upon which to fire - * @param hour the hour (0-23) upon which to fire - * @param minute the minute (0-59) upon which to fire - * @return the newly created trigger - */ - public static Trigger makeMonthlyTrigger( - String trigName, int dayOfMonth, int hour, int minute) { - Trigger trig = makeMonthlyTrigger(dayOfMonth, hour, minute); - trig.setName(trigName); - return trig; - } - - /* - *Make a trigger that will fire every N days at the given time.
- * - *TThe generated trigger will not have its name, group, - * start-time and end-time set.
- * - * @param hour the hour (0-23) upon which to fire @param minute the minute - * (0-59) upon which to fire @param interval the number of days between - * firings public static Trigger makeDailyTrigger(int interval, int hour, - * int minute) { - * - * SimpleTrigger trig = new SimpleTrigger(); - * - * MILLISECONDS_IN_DAY); - * trig.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); - * - * return trig; - * } - */ - - /** - *
- * Make a trigger that will fire repeatCount times, waiting
- * repeatInterval milliseconds between each fire.
- *
- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
+ * Compute theDate that is 1 second after the Nth firing of
+ * the given Trigger, taking the triger's associated
+ * Calendar into consideration.
*
- * @param repeatCount the number of times to fire the trigger
- * @param repeatInterval the number of milliseconds to wait between fires
- * @return the newly created trigger
- */
- public static Trigger makeImmediateTrigger(
- int repeatCount, long repeatInterval) {
- SimpleTrigger trig = new SimpleTrigger();
- trig.setStartTime( new Date() );
- trig.setRepeatCount(repeatCount);
- trig.setRepeatInterval(repeatInterval);
- return trig;
- }
-
- /**
- *
- * Make a trigger that will fire repeatCount times, waiting
- * repeatInterval milliseconds between each fire.
- *
- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param repeatCount the number of times to fire the trigger - * @param repeatInterval the number of milliseconds to wait between fires - * @return the new trigger - */ - public static Trigger makeImmediateTrigger( - String trigName, int repeatCount, long repeatInterval) { - Trigger trig = makeImmediateTrigger(repeatCount, repeatInterval); - trig.setName(trigName); - return trig; - } - - /** - *- * Make a trigger that will fire every second, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * @return the new trigger - */ - public static Trigger makeSecondlyTrigger() { - return makeSecondlyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every second, indefinitely. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @return the new trigger - */ - public static Trigger makeSecondlyTrigger(String trigName) { - return makeSecondlyTrigger( - trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - - /** - *- * Make a trigger that will fire every N seconds, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInSeconds the number of seconds between firings - * @return the new trigger - */ - public static Trigger makeSecondlyTrigger(int intervalInSeconds) { - return makeSecondlyTrigger( - intervalInSeconds, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every N seconds, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInSeconds the number of seconds between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeSecondlyTrigger( - int intervalInSeconds, int repeatCount) { - SimpleTrigger trig = new SimpleTrigger(); - - trig.setRepeatInterval(intervalInSeconds * 1000l); - trig.setRepeatCount(repeatCount); - - return trig; - } - - /** - *- * Make a trigger that will fire every N seconds, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param intervalInSeconds the number of seconds between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeSecondlyTrigger( - String trigName, int intervalInSeconds, int repeatCount) { - Trigger trig = makeSecondlyTrigger(intervalInSeconds, repeatCount); - trig.setName(trigName); - return trig; - } - - /** - *- * Make a trigger that will fire every minute, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @return the new trigger - */ - public static Trigger makeMinutelyTrigger() { - return makeMinutelyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every minute, indefinitely. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @return the new trigger - */ - public static Trigger makeMinutelyTrigger(String trigName) { - return makeMinutelyTrigger( - trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every N minutes, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInMinutes the number of minutes between firings - * @return the new trigger - */ - public static Trigger makeMinutelyTrigger(int intervalInMinutes) { - return makeMinutelyTrigger( - intervalInMinutes, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every N minutes, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInMinutes the number of minutes between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeMinutelyTrigger( - int intervalInMinutes, int repeatCount) { - SimpleTrigger trig = new SimpleTrigger(); - - trig.setRepeatInterval(intervalInMinutes * MILLISECONDS_IN_MINUTE); - trig.setRepeatCount(repeatCount); - - trig.setStartTime(new Date()); - - return trig; - } - - /** - *- * Make a trigger that will fire every N minutes, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param intervalInMinutes the number of minutes between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeMinutelyTrigger( - String trigName, int intervalInMinutes, int repeatCount) { - Trigger trig = makeMinutelyTrigger(intervalInMinutes, repeatCount); - trig.setName(trigName); - return trig; - } - - /** - *- * Make a trigger that will fire every hour, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @return the new trigger - */ - public static Trigger makeHourlyTrigger() { - return makeHourlyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every hour, indefinitely. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @return the new trigger - */ - public static Trigger makeHourlyTrigger(String trigName) { - return makeHourlyTrigger( - trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every N hours, indefinitely. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInHours the number of hours between firings - * @return the new trigger - */ - public static Trigger makeHourlyTrigger(int intervalInHours) { - return makeHourlyTrigger( - intervalInHours, SimpleTrigger.REPEAT_INDEFINITELY); - } - - /** - *- * Make a trigger that will fire every N hours, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its name, group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param intervalInHours the number of hours between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeHourlyTrigger( - int intervalInHours, int repeatCount) { - SimpleTrigger trig = new SimpleTrigger(); - - trig.setRepeatInterval(intervalInHours * MILLISECONDS_IN_HOUR); - trig.setRepeatCount(repeatCount); - - trig.setStartTime(new Date()); - - return trig; - } - - /** - *- * Make a trigger that will fire every N hours, with the given number of - * repeats. - *
- * - *- * The generated trigger will not have its group, - * or end-time set. The Start time defaults to 'now'. - *
- * - * @param trigName the trigger's name - * @param intervalInHours the number of hours between firings - * @param repeatCount the number of times to repeat the firing - * @return the new trigger - */ - public static Trigger makeHourlyTrigger( - String trigName, int intervalInHours, int repeatCount) { - Trigger trig =makeHourlyTrigger(intervalInHours, repeatCount); - trig.setName(trigName); - return trig; - } - - /** - *- * Returns a date that is rounded to the next even hour above the given - * date. - *
- * - *- * 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. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the previous even hour below the given - * date. - *
- * - *- * For example an input date with a time of 08:13:54 would result in a date - * with the time of 08:00:00. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the next even minute above the given - * date. - *
- * - *- * 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. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the previous even minute below the - * given date. - *
- * - *- * For example an input date with a time of 08:13:54 would result in a date - * with the time of 08:13:00. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the next even second above the given - * date. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the previous even second below the - * given date. - *
- * - *- * 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. - *
- * - * @param date - * the Date to round, ifnull the current time will
- * be used
- * @return the new rounded date
- */
- 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();
- }
-
- /**
- * - * Returns a date that is rounded to the next even multiple of the given - * minute. - *
- * - *- * 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. - *
- * - *- * More examples:
| Input Time | - *Minute-Base | - *Result Time | - *
|---|---|---|
| 11:16:41 | - *20 | - *11:20:00 | - *
| 11:36:41 | - *20 | - *11:40:00 | - *
| 11:46:41 | - *20 | - *12:00:00 | - *
| 11:26:41 | - *30 | - *11:30:00 | - *
| 11:36:41 | - *30 | - *12:00:00 | - *11:16:41 | - *17 | - *11:17:00 | - * - * - *11:17:41 | - *17 | - *11:34:00 | - * - * - *11:52:41 | - *17 | - *12:00:00 | - * - * - *11:52:41 | - *5 | - *11:55:00 | - * - * - *11:57:41 | - *5 | - *12:00:00 | - * - * - *11:17:41 | - *0 | - *12:00:00 | - * - * - *11:17:41 | - *1 | - *11:08:00 | - * - *
null the current time will
- * be used
- * @param minuteBase
- * the base-minute to set the time on
- * @return the new rounded date
- *
- * @see #getNextGivenSecondDate(Date, int)
- */
- public static Date getNextGivenMinuteDate(Date date, int minuteBase) {
- if (minuteBase < 0 || minuteBase > 59)
- throw new IllegalArgumentException(
- "minuteBase must be >=0 and <= 59");
-
- if (date == null) date = new Date();
-
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- c.setLenient(true);
-
- if (minuteBase == 0) {
- 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();
- }
-
- int minute = c.get(Calendar.MINUTE);
-
- int arItr = minute / minuteBase;
-
- int nextMinuteOccurance = minuteBase * (arItr + 1);
-
- if (nextMinuteOccurance < 60) {
- c.set(Calendar.MINUTE, nextMinuteOccurance);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
-
- return c.getTime();
- } else {
- 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();
- }
- }
-
- /**
- * - * Returns a date that is rounded to the next even multiple of the given - * minute. - *
- * - *
- * The rules for calculating the second are the same as those for
- * calculating the minute in the method
- * getNextGivenMinuteDate(..).
- *
null the current time will
- * be used
- * @param secondBase the base-second to set the time on
- * @return the new rounded date
- *
- * @see #getNextGivenMinuteDate(Date, int)
- */
- public static Date getNextGivenSecondDate(Date date, int secondBase) {
- if (secondBase < 0 || secondBase > 59)
- throw new IllegalArgumentException(
- "secondBase must be >=0 and <= 59");
-
- if (date == null) date = new Date();
-
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- c.setLenient(true);
-
- if (secondBase == 0) {
- c.set(Calendar.MINUTE, c.get(Calendar.MINUTE) + 1);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
-
- return c.getTime();
- }
-
- int second = c.get(Calendar.SECOND);
-
- int arItr = second / secondBase;
-
- int nextSecondOccurance = secondBase * (arItr + 1);
-
- if (nextSecondOccurance < 60) {
- c.set(Calendar.SECOND, nextSecondOccurance);
- c.set(Calendar.MILLISECOND, 0);
-
- return c.getTime();
- } else {
- c.set(Calendar.MINUTE, c.get(Calendar.MINUTE) + 1);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
-
- return c.getTime();
- }
- }
-
- /**
- *
- * Get a Date object that represents the given time, on
- * today's date.
- *
- * Get a Date object that represents the given time, on the
- * given date.
- *
- * Get a Date object that represents the given time, on the
- * given date.
- *
Trigger.
* The input trigger will be cloned before any work is done, so you need
* not worry about its state being altered by this method.
*
@@ -1223,28 +109,38 @@
* 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
+ * @return the computed Date, or null if the trigger (as configured) will not fire that many times.
*/
- public static List computeFireTimes(Trigger trigg, org.quartz.Calendar cal,
+ public static Date computeEndTimeToAllowParticularNumberOfFirings(OperableTrigger trigg, org.quartz.Calendar cal,
int numTimes) {
- LinkedList lst = new LinkedList();
- Trigger t = (Trigger) trigg.clone();
+ OperableTrigger t = (OperableTrigger) trigg.clone();
if (t.getNextFireTime() == null) {
t.computeFirstFireTime(cal);
}
-
+
+ int c = 0;
+ Date endTime = null;
+
for (int i = 0; i < numTimes; i++) {
Date d = t.getNextFireTime();
if (d != null) {
- lst.add(d);
+ c++;
t.triggered(cal);
- } else
+ if(c == numTimes)
+ endTime = d;
+ } else {
break;
+ }
}
-
- return java.util.Collections.unmodifiableList(lst);
+
+ if(endTime == null)
+ return null;
+
+ endTime = new Date(endTime.getTime() + 1000L);
+
+ return endTime;
}
/**
@@ -1256,7 +152,7 @@
*
* * NOTE: if this is a trigger that has previously fired within the given - * date range, then firings which have already occured will not be listed + * date range, then firings which have already occurred will not be listed * in the output List. *
* @@ -1270,96 +166,36 @@ * The ending date at which to stop finding fire times * @return List of java.util.Date objects */ - public static List computeFireTimesBetween(Trigger trigg, + public static List- * Equivalent of TimeZone.getOffset(date) in JDK 1.4, but Quartz is trying - * to support JDK 1.3. - *
- * - * @param date the date (in milliseconds) that is the base for the offset - * @param tz the time-zone to calculate to offset to - * @return the offset - */ - public static int getOffset(long date, TimeZone tz) { - - if (tz.inDaylightTime(new Date(date))) { - return tz.getRawOffset() + getDSTSavings(tz); - } - - return tz.getRawOffset(); - } - - /** - *- * Equivalent of TimeZone.getDSTSavings() in JDK 1.4, but Quartz is trying - * to support JDK 1.3. - *
- * - * @param tz the target time-zone - * @return the amount of saving time in milliseconds - */ - public static int getDSTSavings(TimeZone tz) { - - if (tz.useDaylightTime()) { - return 3600000; - } - return 0; - } } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/quartz/org/quartz/UICronTrigger.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/quartz/org/quartz/UnableToInterruptJobException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/UnableToInterruptJobException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/quartz/org/quartz/UnableToInterruptJobException.java 17 Aug 2012 15:10:17 -0000 1.1 +++ 3rdParty_sources/quartz/org/quartz/UnableToInterruptJobException.java 15 Dec 2014 10:09:46 -0000 1.1.2.1 @@ -1,6 +1,6 @@ /* - * Copyright 2004-2005 OpenSymphony + * Copyright 2001-2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -16,23 +16,19 @@ * */ -/* - * Previously Copyright (c) 2001-2004 James House - */ - package org.quartz; /** - ** An exception that is thrown to indicate that a call to * InterruptableJob.interrupt() failed without interrupting the Job. - *
* * @see org.quartz.InterruptableJob#interrupt() * * @author James House */ public class UnableToInterruptJobException extends SchedulerException { + + private static final long serialVersionUID = -490863760696463776L; /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -56,7 +52,7 @@ * Create aUnableToInterruptJobException with the given cause.
*
*/
- public UnableToInterruptJobException(Exception cause) {
+ public UnableToInterruptJobException(Throwable cause) {
super(cause);
}
Index: 3rdParty_sources/quartz/org/quartz/package.html
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/quartz/org/quartz/package.html,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/quartz/org/quartz/package.html 17 Aug 2012 15:10:17 -0000 1.1
+++ 3rdParty_sources/quartz/org/quartz/package.html 15 Dec 2014 10:09:47 -0000 1.1.2.1
@@ -8,8 +8,32 @@
See the Quartz project for more information.
+ +Quartz provides a builder-style API for constructing scheduling-related
+entities via a Domain-Specific Language (DSL). The DSL can best be
+utilized through the usage of static imports of the methods on the classes
+TriggerBuilder, JobBuilder,
+DateBuilder, JobKey, TriggerKey
+and the various ScheduleBuilder implementations.
Client code can then use the DSL to write code such as this:
+
+ JobDetail job = newJob(MyJob.class)
+ .withIdentity("myJob")
+ .build();
+
+ Trigger trigger = newTrigger()
+ .withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
+ .withSchedule(simpleSchedule()
+ .withIntervalInHours(1)
+ .repeatForever())
+ .startAt(futureDate(10, MINUTES))
+ .build();
+
+ scheduler.scheduleJob(job, trigger);
+
+