* Cron expressions are comprised of 6 required fields and one optional field separated by
* white space. The fields respectively are described as follows:
- *
- *
+ *
+ *
+ * Examples of cron expressions and their meanings.
*
- * | Field Name |
- * |
- * Allowed Values |
- * |
- * Allowed Special Characters |
+ * Field Name |
+ * |
+ * Allowed Values |
+ * |
+ * Allowed Special Characters |
*
*
- * Seconds |
- *
- * | 0-59 |
- *
- * | , - * / |
+ * Seconds |
+ * |
+ * 0-59 |
+ * |
+ * , - * / |
*
*
- * Minutes |
- *
- * | 0-59 |
- *
- * | , - * / |
+ * Minutes |
+ * |
+ * 0-59 |
+ * |
+ * , - * / |
*
*
- * Hours |
- *
- * | 0-23 |
- *
- * | , - * / |
+ * Hours |
+ * |
+ * 0-23 |
+ * |
+ * , - * / |
*
*
- * Day-of-month |
- *
- * | 1-31 |
- *
- * | , - * ? / L W |
+ * Day-of-month |
+ * |
+ * 1-31 |
+ * |
+ * , - * ? / L W |
*
*
- * Month |
- *
- * | 0-11 or JAN-DEC |
- *
- * | , - * / |
+ * Month |
+ * |
+ * 0-11 or JAN-DEC |
+ * |
+ * , - * / |
*
*
- * Day-of-Week |
- *
- * | 1-7 or SUN-SAT |
- *
- * | , - * ? / L # |
+ * Day-of-Week |
+ * |
+ * 1-7 or SUN-SAT |
+ * |
+ * , - * ? / L # |
*
*
- * Year (Optional) |
- *
- * | empty, 1970-2199 |
- *
- * | , - * / |
+ * Year (Optional) |
+ * |
+ * empty, 1970-2199 |
+ * |
+ * , - * / |
*
*
- *
+ *
* The '*' character is used to specify all values. For example, "*" in the
* minute field means "every minute".
- *
+ *
+ *
* 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 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".
- *
+ *
* The ',' character is used to specify additional values. For example
* "MON,WED,FRI" in the day-of-week field means "the days Monday,
* Wednesday, and Friday".
- *
+ *
+ *
* The '/' character is used to specify increments. For example "0/15" in the
* seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in
* the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*'
@@ -121,7 +98,8 @@ import java.util.TreeSet;
* character simply helps you turn on every "nth" value in the given set. Thus
* "7/6" in the month field only turns on month "7", it does NOT mean
* every 6th month, please note that subtlety.
- *
+ *
+ *
* The 'L' character is allowed for the day-of-month and day-of-week fields. This
* character is short-hand for "last", but it has different meaning in each of
* the two fields. For example, the value "L" in the day-of-month field means
@@ -133,7 +111,8 @@ import java.util.TreeSet;
* 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 example, if you were
* to specify "15W" as the value for the day-of-month field, the meaning is:
@@ -144,10 +123,12 @@ import java.util.TreeSet;
* is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the
* boundary of a month's days. The 'W' character can only be specified when the
* day-of-month is a single day, not a range or list of days.
- *
+ *
+ *
* The 'L' and 'W' characters can also be combined for the day-of-month expression to
* yield 'LW', which translates to "last weekday of the month".
- *
+ *
+ *
* The '#' character is allowed for the day-of-week field. This character is used to
* specify "the nth" XXX day of the month. For example, the value of
* "6#3" in the day-of-week field means the third Friday of the month (day 6 =
@@ -157,19 +138,20 @@ import java.util.TreeSet;
* the month, then 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).
- *
+ *
*
- *
+ *
* The legal characters and the names of months and days of the week are not case
* sensitive.
*
*
* NOTES:
+ *
*
* - Support for specifying both a day-of-week and a day-of-month value is not complete
* (you'll need to use the '?' character in one of these fields).
@@ -180,14 +162,12 @@ import java.util.TreeSet;
* determine which interpretation CronExpression chooses. An example would be "0 0 14-6 ?
* * FRI-MON".
*
- *
*
* @author Sharada Jambula, James House
* @author Contributions from Mads Henderson
* @author Refactoring from CronTrigger to CronExpression by Aaron Craven
*
- * Borrowed from quartz v2.3.1
- *
+ * Borrowed from quartz v2.5.0
*/
public final class CronExpression implements Serializable, Cloneable {
@@ -211,13 +191,19 @@ public final class CronExpression implements Serializable, Cloneable {
protected static final int NO_SPEC_INT = 98; // '?'
+ protected static final int MAX_LAST_DAY_OFFSET = 30;
+
+ protected static final int LAST_DAY_OFFSET_START = 32; // "L-30"
+
+ protected static final int LAST_DAY_OFFSET_END = LAST_DAY_OFFSET_START + MAX_LAST_DAY_OFFSET; // 'L'
+
protected static final Integer ALL_SPEC = ALL_SPEC_INT;
protected static final Integer NO_SPEC = NO_SPEC_INT;
- protected static final Map monthMap = new HashMap(20);
+ protected static final Map monthMap = new HashMap<>(20);
- protected static final Map dayMap = new HashMap(60);
+ protected static final Map dayMap = new HashMap<>(60);
static {
monthMap.put("JAN", 0);
monthMap.put("FEB", 1);
@@ -253,21 +239,17 @@ public final class CronExpression implements Serializable, Cloneable {
protected transient TreeSet daysOfMonth;
+ protected transient TreeSet nearestWeekdays;
+
protected transient TreeSet months;
protected transient TreeSet daysOfWeek;
protected transient TreeSet years;
- protected transient boolean lastdayOfWeek = false;
+ protected transient boolean lastDayOfWeek = false;
- protected transient int nthdayOfWeek = 0;
-
- protected transient boolean lastdayOfMonth = false;
-
- protected transient boolean nearestWeekday = false;
-
- protected transient int lastdayOffset = 0;
+ protected transient int nthDayOfWeek = 0;
protected transient boolean expressionParsed = false;
@@ -305,7 +287,7 @@ public final class CronExpression implements Serializable, Cloneable {
buildExpression(cronExpression);
}
catch (ParseException ex) {
- throw new AssertionError();
+ throw new AssertionError("Could not parse expression!", ex);
}
if (expression.getTimeZone() != null) {
setTimeZone((TimeZone) expression.getTimeZone().clone());
@@ -369,9 +351,9 @@ public final class CronExpression implements Serializable, Cloneable {
// the second immediately following it.
while (difference == 1000) {
newDate = getTimeAfter(lastDate);
- if (newDate == null) {
+ if (newDate == null)
break;
- }
+
difference = newDate.getTime() - lastDate.getTime();
if (difference == 1000) {
@@ -445,39 +427,41 @@ public final class CronExpression implements Serializable, Cloneable {
try {
if (seconds == null) {
- seconds = new TreeSet();
+ seconds = new TreeSet<>();
}
if (minutes == null) {
- minutes = new TreeSet();
+ minutes = new TreeSet<>();
}
if (hours == null) {
- hours = new TreeSet();
+ hours = new TreeSet<>();
}
if (daysOfMonth == null) {
- daysOfMonth = new TreeSet();
+ daysOfMonth = new TreeSet<>();
+ }
+ if (nearestWeekdays == null) {
+ nearestWeekdays = new TreeSet<>();
}
if (months == null) {
- months = new TreeSet();
+ months = new TreeSet<>();
}
if (daysOfWeek == null) {
- daysOfWeek = new TreeSet();
+ daysOfWeek = new TreeSet<>();
}
if (years == null) {
- years = new TreeSet();
+ years = new TreeSet<>();
}
int exprOn = SECOND;
StringTokenizer exprsTok = new StringTokenizer(expression, " \t", false);
+ if (exprsTok.countTokens() > 7) {
+ throw new ParseException("Invalid expression has too many terms: " + expression, -1);
+ }
+
while (exprsTok.hasMoreTokens() && exprOn <= YEAR) {
String expr = exprsTok.nextToken().trim();
- // throw an exception if L is used with other days of the month
- if (exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
- throw new ParseException(
- "Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);
- }
// throw an exception if L is used with other days of the week
if (exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
throw new ParseException(
@@ -524,7 +508,7 @@ public final class CronExpression implements Serializable, Cloneable {
throw pe;
}
catch (Exception e) {
- throw new ParseException("Illegal cron expression format (" + e.toString() + ")", 0);
+ throw new ParseException("Illegal cron expression format (" + e + ")", 0);
}
}
@@ -575,8 +559,8 @@ public final class CronExpression implements Serializable, Cloneable {
else if (c == '#') {
try {
i += 4;
- nthdayOfWeek = Integer.parseInt(s.substring(i));
- if (nthdayOfWeek < 1 || nthdayOfWeek > 5) {
+ nthDayOfWeek = Integer.parseInt(s.substring(i));
+ if (nthDayOfWeek < 1 || nthDayOfWeek > 5) {
throw new Exception();
}
}
@@ -585,7 +569,7 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
else if (c == 'L') {
- lastdayOfWeek = true;
+ lastDayOfWeek = true;
i++;
}
}
@@ -609,9 +593,8 @@ public final class CronExpression implements Serializable, Cloneable {
if (type != DAY_OF_WEEK && type != DAY_OF_MONTH) {
throw new ParseException("'?' can only be specified for Day-of-Month or Day-of-Week.", i);
}
- if (type == DAY_OF_WEEK && !lastdayOfMonth) {
- int val = daysOfMonth.last();
- if (val == NO_SPEC_INT) {
+ if (type == DAY_OF_WEEK) {
+ if (!daysOfMonth.isEmpty() && daysOfMonth.last() == NO_SPEC_INT) {
throw new ParseException("'?' can only be specified for Day-of-Month -OR- Day-of-Week.", i);
}
}
@@ -655,28 +638,35 @@ public final class CronExpression implements Serializable, Cloneable {
}
else if (c == 'L') {
i++;
- if (type == DAY_OF_MONTH) {
- lastdayOfMonth = true;
- }
if (type == DAY_OF_WEEK) {
addToSet(7, 7, 0, type);
}
- if (type == DAY_OF_MONTH && s.length() > i) {
- c = s.charAt(i);
- if (c == '-') {
- ValueSet vs = getValue(0, s, i + 1);
- lastdayOffset = vs.value;
- if (lastdayOffset > 30) {
- throw new ParseException("Offset from last day must be <= 30", i + 1);
- }
- i = vs.pos;
- }
+ if (type == DAY_OF_MONTH) {
+ int dom = LAST_DAY_OFFSET_END;
+ boolean nearestWeekday = false;
if (s.length() > i) {
c = s.charAt(i);
- if (c == 'W') {
- nearestWeekday = true;
- i++;
+ if (c == '-') {
+ ValueSet vs = getValue(0, s, i + 1);
+ int offset = vs.value;
+ if (offset > MAX_LAST_DAY_OFFSET)
+ throw new ParseException("Offset from last day must be <= " + MAX_LAST_DAY_OFFSET, i + 1);
+ dom -= offset;
+ i = vs.pos;
}
+ if (s.length() > i) {
+ c = s.charAt(i);
+ if (c == 'W') {
+ nearestWeekday = true;
+ i++;
+ }
+ }
+ }
+ if (nearestWeekday) {
+ nearestWeekdays.add(dom);
+ }
+ else {
+ daysOfMonth.add(dom);
}
}
return i;
@@ -737,10 +727,9 @@ public final class CronExpression implements Serializable, Cloneable {
if (c == 'L') {
if (type == DAY_OF_WEEK) {
- if (val < 1 || val > 7) {
+ if (val < 1 || val > 7)
throw new ParseException("Day-of-Week values must be between 1 and 7", -1);
- }
- lastdayOfWeek = true;
+ lastDayOfWeek = true;
}
else {
throw new ParseException("'L' option is not valid here. (pos=" + i + ")", i);
@@ -752,19 +741,14 @@ public final class CronExpression implements Serializable, Cloneable {
}
if (c == 'W') {
- if (type == DAY_OF_MONTH) {
- nearestWeekday = true;
- }
- else {
+ if (type != DAY_OF_MONTH) {
throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i);
}
- if (val > 31) {
+ if (val > 31)
throw new ParseException(
"The 'W' option does not make sense with values larger than 31 (max number of days in a month)",
i);
- }
- TreeSet set = getSet(type);
- set.add(val);
+ nearestWeekdays.add(val);
i++;
return i;
}
@@ -775,8 +759,8 @@ public final class CronExpression implements Serializable, Cloneable {
}
i++;
try {
- nthdayOfWeek = Integer.parseInt(s.substring(i));
- if (nthdayOfWeek < 1 || nthdayOfWeek > 5) {
+ nthDayOfWeek = Integer.parseInt(s.substring(i));
+ if (nthDayOfWeek < 1 || nthDayOfWeek > 5) {
throw new Exception();
}
}
@@ -886,23 +870,20 @@ public final class CronExpression implements Serializable, Cloneable {
buf.append("daysOfMonth: ");
buf.append(getExpressionSetSummary(daysOfMonth));
buf.append("\n");
+ buf.append("nearestWeekdays: ");
+ buf.append(getExpressionSetSummary(nearestWeekdays));
+ buf.append("\n");
buf.append("months: ");
buf.append(getExpressionSetSummary(months));
buf.append("\n");
buf.append("daysOfWeek: ");
buf.append(getExpressionSetSummary(daysOfWeek));
buf.append("\n");
- buf.append("lastdayOfWeek: ");
- buf.append(lastdayOfWeek);
- buf.append("\n");
- buf.append("nearestWeekday: ");
- buf.append(nearestWeekday);
+ buf.append("lastDayOfWeek: ");
+ buf.append(lastDayOfWeek);
buf.append("\n");
buf.append("NthDayOfWeek: ");
- buf.append(nthdayOfWeek);
- buf.append("\n");
- buf.append("lastdayOfMonth: ");
- buf.append(lastdayOfMonth);
+ buf.append(nthDayOfWeek);
buf.append("\n");
buf.append("years: ");
buf.append(getExpressionSetSummary(years));
@@ -1226,7 +1207,7 @@ public final class CronExpression implements Serializable, Cloneable {
// get second.................................................
st = seconds.tailSet(sec);
- if (st != null && st.size() != 0) {
+ if (st != null && !st.isEmpty()) {
sec = st.first();
}
else {
@@ -1242,7 +1223,7 @@ public final class CronExpression implements Serializable, Cloneable {
// get minute.................................................
st = minutes.tailSet(min);
- if (st != null && st.size() != 0) {
+ if (st != null && !st.isEmpty()) {
t = min;
min = st.first();
}
@@ -1264,7 +1245,7 @@ public final class CronExpression implements Serializable, Cloneable {
// get hour...................................................
st = hours.tailSet(hr);
- if (st != null && st.size() != 0) {
+ if (st != null && !st.isEmpty()) {
t = hr;
hr = st.first();
}
@@ -1292,67 +1273,13 @@ public final class CronExpression implements Serializable, Cloneable {
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
- st = daysOfMonth.tailSet(day);
- if (lastdayOfMonth) {
- if (!nearestWeekday) {
- t = day;
- day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
- day -= lastdayOffset;
- if (t > day) {
- mon++;
- if (mon > 12) {
- mon = 1;
- tmon = 3333; // ensure test of mon != tmon further below
- // fails
- cl.add(Calendar.YEAR, 1);
- }
- day = 1;
- }
- }
- else {
- t = day;
- day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
- day -= lastdayOffset;
-
- java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
- tcal.set(Calendar.SECOND, 0);
- tcal.set(Calendar.MINUTE, 0);
- tcal.set(Calendar.HOUR_OF_DAY, 0);
- tcal.set(Calendar.DAY_OF_MONTH, day);
- tcal.set(Calendar.MONTH, mon - 1);
- tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR));
-
- int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
- int dow = tcal.get(Calendar.DAY_OF_WEEK);
-
- if (dow == Calendar.SATURDAY && day == 1) {
- day += 2;
- }
- else if (dow == Calendar.SATURDAY) {
- day -= 1;
- }
- else if (dow == Calendar.SUNDAY && day == ldom) {
- day -= 2;
- }
- else if (dow == Calendar.SUNDAY) {
- day += 1;
- }
-
- tcal.set(Calendar.SECOND, sec);
- tcal.set(Calendar.MINUTE, min);
- tcal.set(Calendar.HOUR_OF_DAY, hr);
- tcal.set(Calendar.DAY_OF_MONTH, day);
- tcal.set(Calendar.MONTH, mon - 1);
- Date nTime = tcal.getTime();
- if (nTime.before(afterTime)) {
- day = 1;
- mon++;
- }
- }
- }
- else if (nearestWeekday) {
- t = day;
- day = daysOfMonth.first();
+ Optional smallestDay = findSmallestDay(day, mon, cl.get(Calendar.YEAR), daysOfMonth);
+ Optional smallestDayForWeekday = findSmallestDay(day, mon, cl.get(Calendar.YEAR),
+ nearestWeekdays);
+ t = day;
+ day = -1;
+ if (smallestDayForWeekday.isPresent()) {
+ day = smallestDayForWeekday.get();
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0);
@@ -1385,25 +1312,18 @@ public final class CronExpression implements Serializable, Cloneable {
tcal.set(Calendar.MONTH, mon - 1);
Date nTime = tcal.getTime();
if (nTime.before(afterTime)) {
- day = daysOfMonth.first();
- mon++;
+ day = -1;
}
}
- else if (st != null && st.size() != 0) {
- t = day;
- day = st.first();
- // make sure we don't over-run a short month, such as february
- int lastDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
- if (day > lastDay) {
- day = daysOfMonth.first();
- mon++;
+ if (smallestDay.isPresent()) {
+ if (day == -1 || smallestDay.get() < day) {
+ day = smallestDay.get();
}
}
- else {
- day = daysOfMonth.first();
+ else if (day == -1) {
+ day = 1;
mon++;
}
-
if (day != t || mon != tmon) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
@@ -1416,7 +1336,7 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
- if (lastdayOfWeek) { // are we looking for the last XXX day of
+ if (lastDayOfWeek) { // are we looking for the last XXX day of
// the month?
int dow = daysOfWeek.first(); // desired
// d-o-w
@@ -1460,7 +1380,7 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
- else if (nthdayOfWeek != 0) {
+ else if (nthDayOfWeek != 0) {
// are we looking for the Nth XXX day in the month?
int dow = daysOfWeek.first(); // desired
// d-o-w
@@ -1473,10 +1393,7 @@ public final class CronExpression implements Serializable, Cloneable {
daysToAdd = dow + (7 - cDow);
}
- boolean dayShifted = false;
- if (daysToAdd > 0) {
- dayShifted = true;
- }
+ boolean dayShifted = daysToAdd > 0;
day += daysToAdd;
int weekOfMonth = day / 7;
@@ -1484,7 +1401,7 @@ public final class CronExpression implements Serializable, Cloneable {
weekOfMonth++;
}
- daysToAdd = (nthdayOfWeek - weekOfMonth) * 7;
+ daysToAdd = (nthDayOfWeek - weekOfMonth) * 7;
day += daysToAdd;
if (daysToAdd < 0 || day > getLastDayOfMonth(mon, cl.get(Calendar.YEAR))) {
cl.set(Calendar.SECOND, 0);
@@ -1510,7 +1427,7 @@ public final class CronExpression implements Serializable, Cloneable {
int dow = daysOfWeek.first(); // desired
// d-o-w
st = daysOfWeek.tailSet(cDow);
- if (st != null && st.size() > 0) {
+ if (st != null && !st.isEmpty()) {
dow = st.first();
}
@@ -1534,7 +1451,7 @@ public final class CronExpression implements Serializable, Cloneable {
// no '- 1' here because we are promoting the month
continue;
}
- else if (daysToAdd > 0) { // are we swithing days?
+ else if (daysToAdd > 0) { // are we switching days?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
@@ -1566,7 +1483,7 @@ public final class CronExpression implements Serializable, Cloneable {
// get month...................................................
st = months.tailSet(mon);
- if (st != null && st.size() != 0) {
+ if (st != null && !st.isEmpty()) {
t = mon;
mon = st.first();
}
@@ -1594,7 +1511,7 @@ public final class CronExpression implements Serializable, Cloneable {
// get year...................................................
st = years.tailSet(year);
- if (st != null && st.size() != 0) {
+ if (st != null && !st.isEmpty()) {
t = year;
year = st.first();
}
@@ -1688,6 +1605,27 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
+ private Optional findSmallestDay(int day, int mon, int year, TreeSet set) {
+ if (set.isEmpty()) {
+ return Optional.empty();
+ }
+
+ final int lastDay = getLastDayOfMonth(mon, year);
+ // For "L", "L-1", etc.
+ int smallestDay = Optional.ofNullable(set.ceiling(LAST_DAY_OFFSET_END - (lastDay - day)))
+ .map(d -> d - LAST_DAY_OFFSET_START + 1)
+ .orElse(Integer.MAX_VALUE);
+
+ // For "1", "2", etc.
+ SortedSet st = set.subSet(day, LAST_DAY_OFFSET_START);
+ // make sure we don't over-run a short month, such as february
+ if (!st.isEmpty() && st.first() < smallestDay && st.first() <= lastDay) {
+ smallestDay = st.first();
+ }
+
+ return smallestDay == Integer.MAX_VALUE ? Optional.empty() : Optional.of(smallestDay);
+ }
+
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, ClassNotFoundException {
stream.defaultReadObject();
@@ -1703,7 +1641,6 @@ public final class CronExpression implements Serializable, Cloneable {
public Object clone() {
return new CronExpression(this);
}
-
}
class ValueSet {
@@ -1711,5 +1648,4 @@ class ValueSet {
public int value;
public int pos;
-
-}
+}
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
index db3c5573f..c1dd3b35c 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
@@ -12,11 +12,9 @@ public class XxlJobInfo {
private int id; // 主键ID
private int jobGroup; // 执行器主键ID
-
private String jobDesc;
private Date addTime;
-
private Date updateTime;
private String author; // 负责人
@@ -57,6 +55,7 @@ public class XxlJobInfo {
private long triggerNextTime; // 下次调度时间
+
public int getId() {
return id;
}
@@ -248,5 +247,4 @@ public class XxlJobInfo {
public void setTriggerNextTime(long triggerNextTime) {
this.triggerNextTime = triggerNextTime;
}
-
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
index a9da03fc2..6ba7df02a 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
@@ -13,32 +13,23 @@ public class XxlJobLog {
// job info
private int jobGroup;
-
private int jobId;
// execute info
private String executorAddress;
-
private String executorHandler;
-
private String executorParam;
-
private String executorShardingParam;
-
private int executorFailRetryCount;
// trigger info
private Date triggerTime;
-
private int triggerCode;
-
private String triggerMsg;
// handle info
private Date handleTime;
-
private int handleCode;
-
private String handleMsg;
// alarm info
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
index 040cab06d..303b57456 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
@@ -4,7 +4,6 @@ import java.util.Date;
/**
* xxl-job log for glue, used to track job code process
- *
* @author xuxueli 2016-5-19 17:57:46
*/
public class XxlJobLogGlue {
@@ -14,13 +13,9 @@ public class XxlJobLogGlue {
private int jobId; // 任务主键ID
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
-
private String glueSource;
-
private String glueRemark;
-
private Date addTime;
-
private Date updateTime;
public int getId() {
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java
index bf7907f8c..931863ac9 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java
@@ -53,5 +53,4 @@ public class XxlJobLogReport {
public void setFailCount(int failCount) {
this.failCount = failCount;
}
-
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
index d8e5da2fa..4788c163e 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
@@ -56,5 +56,4 @@ public class XxlJobRegistry {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
-
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
index 5ef102e56..3a5dd759e 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
@@ -1,7 +1,7 @@
package com.xxl.job.admin.core.route.strategy;
-import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
import com.xxl.job.admin.core.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.IdleBeatParam;
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
index a60d8f69a..05ec62c8b 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
@@ -1,7 +1,7 @@
package com.xxl.job.admin.core.route.strategy;
-import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
import com.xxl.job.admin.core.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.ReturnT;
@@ -49,5 +49,4 @@ public class ExecutorRouteFailover extends ExecutorRouter {
return new ReturnT(ReturnT.FAIL_CODE, beatResultSB.toString());
}
-
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java
index 256521e15..72d851fe1 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java
@@ -20,7 +20,6 @@ import java.util.concurrent.*;
* @author xuxueli 2015-9-1 18:05:56
*/
public class JobCompleteHelper {
-
private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
private static JobCompleteHelper instance = new JobCompleteHelper();
@@ -32,9 +31,7 @@ public class JobCompleteHelper {
// ---------------------- monitor ----------------------
private ThreadPoolExecutor callbackThreadPool = null;
-
private Thread monitorThread;
-
private volatile boolean toStop = false;
public void start() {
@@ -55,6 +52,7 @@ public class JobCompleteHelper {
}
});
+
// for monitor
monitorThread = new Thread(new Runnable() {
@@ -137,6 +135,7 @@ public class JobCompleteHelper {
}
}
+
// ---------------------- helper ----------------------
public ReturnT callback(List callbackParamList) {
@@ -190,4 +189,5 @@ public class JobCompleteHelper {
return ReturnT.SUCCESS;
}
+
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
index 722aaed6a..21f45acb8 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
@@ -17,7 +17,6 @@ import java.util.concurrent.TimeUnit;
* @author xuxueli 2015-9-1 18:05:56
*/
public class JobFailMonitorHelper {
-
private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
@@ -29,7 +28,6 @@ public class JobFailMonitorHelper {
// ---------------------- monitor ----------------------
private Thread monitorThread;
-
private volatile boolean toStop = false;
public void start() {
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java
index 7be954ae2..acc4d641a 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java
@@ -10,214 +10,216 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
-import java.time.Instant;
-import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.*;
/**
* job registry instance
- *
* @author xuxueli 2016-10-02 19:10:24
*/
public class JobRegistryHelper {
- private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
+ private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
- private static JobRegistryHelper instance = new JobRegistryHelper();
+ private static JobRegistryHelper instance = new JobRegistryHelper();
+ private ThreadPoolExecutor registryOrRemoveThreadPool = null;
+ private Thread registryMonitorThread;
+ private volatile boolean toStop = false;
- public static JobRegistryHelper getInstance() {
- return instance;
- }
+ public static JobRegistryHelper getInstance() {
+ return instance;
+ }
- private ThreadPoolExecutor registryOrRemoveThreadPool = null;
+ public void start() {
- private Thread registryMonitorThread;
+ // for registry or remove
+ registryOrRemoveThreadPool = new ThreadPoolExecutor(2, 10, 30L, TimeUnit.SECONDS,
+ new LinkedBlockingQueue(2000), new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r,
+ "xxl-job, admin JobRegistryMonitorHelper-registryOrRemoveThreadPool-" + r.hashCode());
+ }
+ }, new RejectedExecutionHandler() {
+ @Override
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
+ r.run();
+ logger.warn(
+ ">>>>>>>>>>> xxl-job, registry or remove too fast, match threadpool rejected handler(run now).");
+ }
+ });
- private volatile boolean toStop = false;
+ // for monitor
+ registryMonitorThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (!toStop) {
+ try {
+ // auto registry group
+ List groupList = XxlJobAdminConfig.getAdminConfig()
+ .getXxlJobGroupDao()
+ .findByAddressType(0);
+ if (groupList != null && !groupList.isEmpty()) {
- public void start() {
+ // remove dead address (admin/executor)
+ List ids = XxlJobAdminConfig.getAdminConfig()
+ .getXxlJobRegistryDao()
+ .findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
+ if (ids != null && ids.size() > 0) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
+ }
- // for registry or remove
- registryOrRemoveThreadPool = new ThreadPoolExecutor(2, 10, 30L, TimeUnit.SECONDS,
- new LinkedBlockingQueue(2000), new ThreadFactory() {
- @Override
- public Thread newThread(Runnable r) {
- return new Thread(r,
- "xxl-job, admin JobRegistryMonitorHelper-registryOrRemoveThreadPool-" + r.hashCode());
- }
- }, new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- r.run();
- logger.warn(
- ">>>>>>>>>>> xxl-job, registry or remove too fast, match threadpool rejected handler(run now).");
- }
- });
+ // fresh online address (admin/executor)
+ HashMap> appAddressMap = new HashMap>();
+ List list = XxlJobAdminConfig.getAdminConfig()
+ .getXxlJobRegistryDao()
+ .findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
+ if (list != null) {
+ for (XxlJobRegistry item : list) {
+ if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
+ String appname = item.getRegistryKey();
+ List registryList = appAddressMap.get(appname);
+ if (registryList == null) {
+ registryList = new ArrayList();
+ }
- // for monitor
- registryMonitorThread = new Thread(new Runnable() {
- @Override
- public void run() {
- while (!toStop) {
- try {
- // auto registry group
- List groupList = XxlJobAdminConfig.getAdminConfig()
- .getXxlJobGroupDao()
- .findByAddressType(0);
- if (groupList != null && !groupList.isEmpty()) {
+ if (!registryList.contains(item.getRegistryValue())) {
+ registryList.add(item.getRegistryValue());
+ }
+ appAddressMap.put(appname, registryList);
+ }
+ }
+ }
- // remove dead address (admin/executor)
- Instant now = Instant.now();
- Instant expiredInstant = now.minus(RegistryConfig.DEAD_TIMEOUT, ChronoUnit.SECONDS); // 假设 timeout 单位是秒
- Date expiredTime = Date.from(expiredInstant);
- List ids = XxlJobAdminConfig.getAdminConfig()
- .getXxlJobRegistryDao()
- .findDead(expiredTime);
- if (ids != null && ids.size() > 0) {
- XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
- }
+ // fresh group address
+ for (XxlJobGroup group : groupList) {
+ List registryList = appAddressMap.get(group.getAppname());
+ String addressListStr = null;
+ if (registryList != null && !registryList.isEmpty()) {
+ Collections.sort(registryList);
+ StringBuilder addressListSB = new StringBuilder();
+ for (String item : registryList) {
+ addressListSB.append(item).append(",");
+ }
+ addressListStr = addressListSB.toString();
+ addressListStr = addressListStr.substring(0, addressListStr.length() - 1);
+ }
+ group.setAddressList(addressListStr);
+ group.setUpdateTime(new Date());
- // fresh online address (admin/executor)
- HashMap> appAddressMap = new HashMap>();
- List list = XxlJobAdminConfig.getAdminConfig()
- .getXxlJobRegistryDao()
- .findAll(expiredTime);
- if (list != null) {
- for (XxlJobRegistry item : list) {
- if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
- String appname = item.getRegistryKey();
- List registryList = appAddressMap.get(appname);
- if (registryList == null) {
- registryList = new ArrayList();
- }
+ XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
+ }
+ }
+ }
+ catch (Throwable e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
+ }
+ }
+ try {
+ TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
+ }
+ catch (Throwable e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
+ }
+ }
+ }
+ logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
+ }
+ });
+ registryMonitorThread.setDaemon(true);
+ registryMonitorThread.setName("xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread");
+ registryMonitorThread.start();
+ }
- if (!registryList.contains(item.getRegistryValue())) {
- registryList.add(item.getRegistryValue());
- }
- appAddressMap.put(appname, registryList);
- }
- }
- }
+ public void toStop() {
+ toStop = true;
- // fresh group address
- for (XxlJobGroup group : groupList) {
- List registryList = appAddressMap.get(group.getAppname());
- String addressListStr = null;
- if (registryList != null && !registryList.isEmpty()) {
- Collections.sort(registryList);
- StringBuilder addressListSB = new StringBuilder();
- for (String item : registryList) {
- addressListSB.append(item).append(",");
- }
- addressListStr = addressListSB.toString();
- addressListStr = addressListStr.substring(0, addressListStr.length() - 1);
- }
- group.setAddressList(addressListStr);
- group.setUpdateTime(new Date());
+ // stop registryOrRemoveThreadPool
+ registryOrRemoveThreadPool.shutdownNow();
- XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
- }
- }
- } catch (Exception e) {
- if (!toStop) {
- logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
- }
- }
- try {
- TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
- } catch (InterruptedException e) {
- if (!toStop) {
- logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
- }
- }
- }
- logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
- }
- });
- registryMonitorThread.setDaemon(true);
- registryMonitorThread.setName("xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread");
- registryMonitorThread.start();
- }
+ // stop monitir (interrupt and wait)
+ registryMonitorThread.interrupt();
+ try {
+ registryMonitorThread.join();
+ }
+ catch (Throwable e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
- public void toStop() {
- toStop = true;
+ // ---------------------- helper ----------------------
- // stop registryOrRemoveThreadPool
- registryOrRemoveThreadPool.shutdownNow();
+ public ReturnT registry(RegistryParam registryParam) {
- // stop monitir (interrupt and wait)
- registryMonitorThread.interrupt();
- try {
- registryMonitorThread.join();
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- }
- }
+ // valid
+ if (!StringUtils.hasText(registryParam.getRegistryGroup())
+ || !StringUtils.hasText(registryParam.getRegistryKey())
+ || !StringUtils.hasText(registryParam.getRegistryValue())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
+ }
- // ---------------------- helper ----------------------
+ // async execute
+ registryOrRemoveThreadPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ // 0-fail; 1-save suc; 2-update suc;
+ int ret = XxlJobAdminConfig.getAdminConfig()
+ .getXxlJobRegistryDao()
+ .registrySaveOrUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
+ registryParam.getRegistryValue(), new Date());
+ if (ret == 1) {
+ // fresh (add)
+ freshGroupRegistryInfo(registryParam);
+ }
+ /*
+ * int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().
+ * registryUpdate(registryParam.getRegistryGroup(),
+ * registryParam.getRegistryKey(), registryParam.getRegistryValue(), new
+ * Date()); if (ret < 1) {
+ * XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(
+ * registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
+ * registryParam.getRegistryValue(), new Date());
+ *
+ * // fresh freshGroupRegistryInfo(registryParam); }
+ */
+ }
+ });
- public ReturnT registry(RegistryParam registryParam) {
+ return ReturnT.SUCCESS;
+ }
- // valid
- if (!StringUtils.hasText(registryParam.getRegistryGroup())
- || !StringUtils.hasText(registryParam.getRegistryKey())
- || !StringUtils.hasText(registryParam.getRegistryValue())) {
- return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
- }
+ public ReturnT registryRemove(RegistryParam registryParam) {
- // async execute
- registryOrRemoveThreadPool.execute(new Runnable() {
- @Override
- public void run() {
- int ret = XxlJobAdminConfig.getAdminConfig()
- .getXxlJobRegistryDao()
- .registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
- registryParam.getRegistryValue(), new Date());
- if (ret < 1) {
- XxlJobAdminConfig.getAdminConfig()
- .getXxlJobRegistryDao()
- .registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
- registryParam.getRegistryValue(), new Date());
+ // valid
+ if (!StringUtils.hasText(registryParam.getRegistryGroup())
+ || !StringUtils.hasText(registryParam.getRegistryKey())
+ || !StringUtils.hasText(registryParam.getRegistryValue())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
+ }
- // fresh
- freshGroupRegistryInfo(registryParam);
- }
- }
- });
+ // async execute
+ registryOrRemoveThreadPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ int ret = XxlJobAdminConfig.getAdminConfig()
+ .getXxlJobRegistryDao()
+ .registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
+ registryParam.getRegistryValue());
+ if (ret > 0) {
+ // fresh (delete)
+ freshGroupRegistryInfo(registryParam);
+ }
+ }
+ });
- return ReturnT.SUCCESS;
- }
+ return ReturnT.SUCCESS;
+ }
- public ReturnT registryRemove(RegistryParam registryParam) {
+ private void freshGroupRegistryInfo(RegistryParam registryParam) {
+ // Under consideration, prevent affecting core tables
+ }
- // valid
- if (!StringUtils.hasText(registryParam.getRegistryGroup())
- || !StringUtils.hasText(registryParam.getRegistryKey())
- || !StringUtils.hasText(registryParam.getRegistryValue())) {
- return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
- }
-
- // async execute
- registryOrRemoveThreadPool.execute(new Runnable() {
- @Override
- public void run() {
- int ret = XxlJobAdminConfig.getAdminConfig()
- .getXxlJobRegistryDao()
- .registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(),
- registryParam.getRegistryValue());
- if (ret > 0) {
- // fresh
- freshGroupRegistryInfo(registryParam);
- }
- }
- });
-
- return ReturnT.SUCCESS;
- }
-
- private void freshGroupRegistryInfo(RegistryParam registryParam) {
- // Under consideration, prevent affecting core tables
- }
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
index 08360309d..62dbf9ea5 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
@@ -419,7 +419,7 @@ public class JobScheduleHelper {
* FIX_DELAY ==
* scheduleTypeEnum
*/) {
- return new Date(fromTime.getTime() + Integer.valueOf(jobInfo.getScheduleConf()) * 1000);
+ return new Date(fromTime.getTime() + Long.parseLong(jobInfo.getScheduleConf()) * 1000L);
}
return null;
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
index b42c83d04..ca0590aea 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
@@ -57,6 +57,7 @@ public class JobTriggerPoolHelper {
});
}
+
public void stop() {
// triggerPool.shutdown();
fastTriggerPool.shutdownNow();
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java
index 53f27f754..dda28d282 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java
@@ -13,7 +13,6 @@ public class CookieUtil {
// 默认缓存时间,单位/秒, 2H
private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
-
// 保存路径,根路径
private static final String COOKIE_PATH = "/";
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java
index 8756faabd..6be7e7756 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java
@@ -12,13 +12,12 @@ import java.io.IOException;
/**
* Jackson util
- *
+ *
* 1、obj need private and set/get; 2、do not support inner class;
- *
+ *
* @author xuxueli 2015-9-25 18:02:56
*/
public class JacksonUtil {
-
private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
private final static ObjectMapper objectMapper = new ObjectMapper();
@@ -96,5 +95,4 @@ public class JacksonUtil {
}
return null;
}
-
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java
index 23b4c5813..c2d991af6 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java
@@ -55,6 +55,7 @@ public class LocalCacheUtil {
}
+
/**
* set cache
* @param key
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java
index 4e54daec1..d6b9bb9b7 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java
@@ -6,9 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
+
/**
* job info
- *
* @author xuxueli 2016-1-12 18:03:45
*/
@Mapper
@@ -23,7 +23,7 @@ public interface XxlJobInfoDao {
@Param("jobGroup") int jobGroup, @Param("triggerStatus") int triggerStatus,
@Param("jobDesc") String jobDesc, @Param("executorHandler") String executorHandler,
@Param("author") String author);
-
+
public int save(XxlJobInfo info);
public XxlJobInfo loadById(@Param("id") int id);
@@ -54,4 +54,5 @@ public interface XxlJobInfoDao {
*/
public int scheduleUpdate(XxlJobInfo xxlJobInfo);
+
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java
index a42c08b0c..29d617107 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java
@@ -10,7 +10,6 @@ import java.util.Map;
/**
* job log
- *
* @author xuxueli 2016-1-12 18:03:06
*/
@Mapper
@@ -26,7 +25,7 @@ public interface XxlJobLogDao {
@Param("jobGroup") int jobGroup, @Param("jobId") int jobId,
@Param("triggerTimeStart") Date triggerTimeStart, @Param("triggerTimeEnd") Date triggerTimeEnd,
@Param("logStatus") int logStatus);
-
+
public XxlJobLog load(@Param("id") long id);
public long save(XxlJobLog xxlJobLog);
@@ -42,7 +41,6 @@ public interface XxlJobLogDao {
public List findClearLogIds(@Param("jobGroup") int jobGroup, @Param("jobId") int jobId,
@Param("clearBeforeTime") Date clearBeforeTime, @Param("clearBeforeNum") int clearBeforeNum,
@Param("pagesize") int pagesize);
-
public int clearLog(@Param("logIds") List logIds);
public List findFailJobLogIds(@Param("pagesize") int pagesize);
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java
index d426f65f8..a4e30ae37 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java
@@ -8,7 +8,6 @@ import java.util.List;
/**
* job log for glue
- *
* @author xuxueli 2016-5-19 18:04:56
*/
@Mapper
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java
index 9d1d9e369..28c5f3e18 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java
@@ -9,7 +9,6 @@ import java.util.List;
/**
* job log
- *
* @author xuxueli 2019-11-22
*/
@Mapper
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
index 26e0a25bc..ee1562edb 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
@@ -13,17 +13,33 @@ import java.util.List;
@Mapper
public interface XxlJobRegistryDao {
- public List findDead(@Param("expiredTime") Date expiredTime);
+ public List findDead(@Param("timeout") int timeout, @Param("nowTime") Date nowTime);
public int removeDead(@Param("ids") List ids);
- public List findAll(@Param("expiredTime") Date expiredTime);
+ public List findAll(@Param("timeout") int timeout, @Param("nowTime") Date nowTime);
- public int registryUpdate(@Param("registryGroup") String registryGroup, @Param("registryKey") String registryKey,
- @Param("registryValue") String registryValue, @Param("updateTime") Date updateTime);
+ public int registrySaveOrUpdate(@Param("registryGroup") String registryGroup,
+ @Param("registryKey") String registryKey, @Param("registryValue") String registryValue,
+ @Param("updateTime") Date updateTime);
- public int registrySave(@Param("registryGroup") String registryGroup, @Param("registryKey") String registryKey,
- @Param("registryValue") String registryValue, @Param("updateTime") Date updateTime);
+ /*
+ * public int registryUpdate(@Param("registryGroup") String registryGroup,
+ *
+ * @Param("registryKey") String registryKey,
+ *
+ * @Param("registryValue") String registryValue,
+ *
+ * @Param("updateTime") Date updateTime);
+ *
+ * public int registrySave(@Param("registryGroup") String registryGroup,
+ *
+ * @Param("registryKey") String registryKey,
+ *
+ * @Param("registryValue") String registryValue,
+ *
+ * @Param("updateTime") Date updateTime);
+ */
public int registryDelete(@Param("registryGroup") String registryGroup, @Param("registryKey") String registryKey,
@Param("registryValue") String registryValue);
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java
index ec512f7ae..3f32934e7 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java
@@ -1,5 +1,6 @@
package com.xxl.job.admin.service;
+
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.model.XxlJobUser;
import com.xxl.job.core.biz.model.ReturnT;
@@ -9,7 +10,7 @@ import java.util.Map;
/**
* core job action for xxl-job
- *
+ *
* @author xuxueli 2016-5-28 15:30:33
*/
public interface XxlJobService {
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java
index 241a32f57..18a49e868 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java
@@ -106,4 +106,5 @@ public class LoginService {
return null;
}
+
}
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
index f97956f93..999926d20 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
@@ -28,26 +28,20 @@ import java.util.*;
/**
* core job action for xxl-job
- *
* @author xuxueli 2016-5-28 15:30:33
*/
@Service
public class XxlJobServiceImpl implements XxlJobService {
-
private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
@Resource
private XxlJobGroupDao xxlJobGroupDao;
-
@Resource
private XxlJobInfoDao xxlJobInfoDao;
-
@Resource
public XxlJobLogDao xxlJobLogDao;
-
@Resource
private XxlJobLogGlueDao xxlJobLogGlueDao;
-
@Resource
private XxlJobLogReportDao xxlJobLogReportDao;
@@ -60,7 +54,7 @@ public class XxlJobServiceImpl implements XxlJobService {
author);
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler,
author);
-
+
// package result
Map maps = new HashMap();
maps.put("recordsTotal", list_count); // 总记录数
@@ -185,6 +179,8 @@ public class XxlJobServiceImpl implements XxlJobService {
jobInfo.setAddTime(new Date());
jobInfo.setUpdateTime(new Date());
jobInfo.setGlueUpdatetime(new Date());
+ // remove the whitespace
+ jobInfo.setExecutorHandler(jobInfo.getExecutorHandler().trim());
xxlJobInfoDao.save(jobInfo);
if (jobInfo.getId() < 1) {
return new ReturnT(ReturnT.FAIL_CODE,
@@ -349,7 +345,8 @@ public class XxlJobServiceImpl implements XxlJobService {
exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
- exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
+ // remove the whitespace
+ exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler().trim());
exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
@@ -360,6 +357,7 @@ public class XxlJobServiceImpl implements XxlJobService {
exists_jobInfo.setUpdateTime(new Date());
xxlJobInfoDao.update(exists_jobInfo);
+
return ReturnT.SUCCESS;
}
@@ -378,7 +376,11 @@ public class XxlJobServiceImpl implements XxlJobService {
@Override
public ReturnT start(int id) {
+ // load and valid
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+ if (xxlJobInfo == null) {
+ return new ReturnT(ReturnT.FAIL.getCode(), I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
+ }
// valid
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
@@ -414,8 +416,13 @@ public class XxlJobServiceImpl implements XxlJobService {
@Override
public ReturnT stop(int id) {
+ // load and valid
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+ if (xxlJobInfo == null) {
+ return new ReturnT(ReturnT.FAIL.getCode(), I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
+ }
+ // stop
xxlJobInfo.setTriggerStatus(0);
xxlJobInfo.setTriggerLastTime(0);
xxlJobInfo.setTriggerNextTime(0);
@@ -425,6 +432,7 @@ public class XxlJobServiceImpl implements XxlJobService {
return ReturnT.SUCCESS;
}
+
@Override
public ReturnT trigger(XxlJobUser loginUser, int jobId, String executorParam, String addressList) {
// permission
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_en.properties b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_en.properties
index 9c2eb9e7f..a6e4d1e11 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_en.properties
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_en.properties
@@ -1,6 +1,6 @@
admin_name=Scheduling Center
admin_name_full=Distributed Task Scheduling Platform XXL-JOB
-admin_version=3.0.0
+admin_version=3.1.1
admin_i18n=en
## system
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties
index 9d48b1150..4ae39f675 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties
@@ -1,6 +1,6 @@
admin_name=任务调度中心
admin_name_full=分布式任务调度平台XXL-JOB
-admin_version=3.0.0
+admin_version=3.1.1
admin_i18n=
## system
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties
index c25aeffe0..22e144358 100755
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties
@@ -1,6 +1,6 @@
admin_name=任務調度中心
admin_name_full=分布式任務調度平臺XXL-JOB
-admin_version=3.0.0
+admin_version=3.1.1
admin_i18n=
## system
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml
index fd1846abe..a44dd9726 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml
@@ -1,12 +1,12 @@
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
-
-
+
+
@@ -35,17 +35,17 @@
- INSERT INTO xxl_job_group ( app_name, title, address_type, address_list, update_time)
+ INSERT INTO xxl_job_group ( `app_name`, `title`, `address_type`, `address_list`, `update_time`)
values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
UPDATE xxl_job_group
- SET app_name = #{appname},
- title = #{title},
- address_type = #{addressType},
- address_list = #{addressList},
- update_time = #{updateTime}
+ SET `app_name` = #{appname},
+ `title` = #{title},
+ `address_type` = #{addressType},
+ `address_list` = #{addressList},
+ `update_time` = #{updateTime}
WHERE id = #{id}
@@ -88,4 +88,4 @@
-
+
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
index 378e23df9..1723d9260 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
@@ -188,8 +188,8 @@
executor_handler = #{executorHandler},
executor_param = #{executorParam},
executor_block_strategy = #{executorBlockStrategy},
- executor_timeout = ${executorTimeout},
- executor_fail_retry_count = ${executorFailRetryCount},
+ executor_timeout = #{executorTimeout},
+ executor_fail_retry_count = #{executorFailRetryCount},
glue_type = #{glueType},
glue_source = #{glueSource},
glue_remark = #{glueRemark},
@@ -232,11 +232,12 @@
UPDATE xxl_job_info
SET
trigger_last_time = #{triggerLastTime},
- trigger_next_time = #{triggerNextTime}
-
- , trigger_status = #{triggerStatus}
-
+ trigger_next_time = #{triggerNextTime}
+
+ , trigger_status = #{triggerStatus}
+
WHERE id = #{id}
+ AND trigger_status = 1
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml
index 8da58647a..4e351bb5a 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml
@@ -1,16 +1,16 @@
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
-
+
-
-
-
-
+
+
+
+
@@ -23,49 +23,49 @@
t.update_time
-
+
INSERT INTO xxl_job_logglue (
- job_id,
- glue_type,
- glue_source,
- glue_remark,
- add_time,
- update_time
+ `job_id`,
+ `glue_type`,
+ `glue_source`,
+ `glue_remark`,
+ `add_time`,
+ `update_time`
) VALUES (
- #{jobId},
- #{glueType},
- #{glueSource},
- #{glueRemark},
- #{addTime},
- #{updateTime}
+ #{jobId},
+ #{glueType},
+ #{glueSource},
+ #{glueRemark},
+ #{addTime},
+ #{updateTime}
);
-
+
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
index 4f7727450..2fa448b29 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
@@ -1,9 +1,9 @@
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
@@ -11,17 +11,17 @@
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -44,7 +44,7 @@
t.alarm_status
-
+
SELECT
FROM xxl_job_log AS t
@@ -65,8 +65,8 @@
AND (
- t.trigger_code NOT IN (0, 200) OR
- t.handle_code NOT IN (0, 200)
+ t.trigger_code NOT IN (0, 200) OR
+ t.handle_code NOT IN (0, 200)
)
@@ -78,7 +78,7 @@
LIMIT #{offset}, #{pagesize}
-
+
SELECT count(1)
FROM xxl_job_log AS t
@@ -99,8 +99,8 @@
AND (
- t.trigger_code NOT IN (0, 200) OR
- t.handle_code NOT IN (0, 200)
+ t.trigger_code NOT IN (0, 200) OR
+ t.handle_code NOT IN (0, 200)
)
@@ -110,80 +110,80 @@
-
+
SELECT
FROM xxl_job_log AS t
WHERE t.id = #{id}
-
+
INSERT INTO xxl_job_log (
- job_group,
- job_id,
- trigger_time,
- trigger_code,
- handle_code
+ `job_group`,
+ `job_id`,
+ `trigger_time`,
+ `trigger_code`,
+ `handle_code`
) VALUES (
- #{jobGroup},
- #{jobId},
- #{triggerTime},
- #{triggerCode},
- #{handleCode}
+ #{jobGroup},
+ #{jobId},
+ #{triggerTime},
+ #{triggerCode},
+ #{handleCode}
);
UPDATE xxl_job_log
SET
- trigger_time= #{triggerTime},
- trigger_code= #{triggerCode},
- trigger_msg= #{triggerMsg},
- executor_address= #{executorAddress},
- executor_handler=#{executorHandler},
- executor_param= #{executorParam},
- executor_sharding_param= #{executorShardingParam},
- executor_fail_retry_count= #{executorFailRetryCount}
- WHERE id= #{id}
+ `trigger_time`= #{triggerTime},
+ `trigger_code`= #{triggerCode},
+ `trigger_msg`= #{triggerMsg},
+ `executor_address`= #{executorAddress},
+ `executor_handler`=#{executorHandler},
+ `executor_param`= #{executorParam},
+ `executor_sharding_param`= #{executorShardingParam},
+ `executor_fail_retry_count`= #{executorFailRetryCount}
+ WHERE `id`= #{id}
UPDATE xxl_job_log
- SET
- handle_time= #{handleTime},
- handle_code= #{handleCode},
- handle_msg= #{handleMsg}
- WHERE id= #{id}
+ SET
+ `handle_time`= #{handleTime},
+ `handle_code`= #{handleCode},
+ `handle_msg`= #{handleMsg}
+ WHERE `id`= #{id}
-
+
delete from xxl_job_log
WHERE job_id = #{jobId}
-
-
-
+
+
+
+ SELECT
+ COUNT(handle_code) `triggerDayCount`,
+ SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as `triggerDayCountRunning`,
+ SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as `triggerDayCountSuc`
+ FROM xxl_job_log
+ WHERE trigger_time BETWEEN #{from} and #{to}
+
SELECT id FROM xxl_job_log
@@ -228,15 +228,13 @@
- SELECT id
- FROM xxl_job_log
- WHERE
- NOT (
- (trigger_code IN (0, 200) AND handle_code = 0)
- OR
- (handle_code = 200)
+ SELECT id FROM `xxl_job_log`
+ WHERE !(
+ (trigger_code in (0, 200) and handle_code = 0)
+ OR
+ (handle_code = 200)
)
- AND alarm_status = 0
+ AND `alarm_status` = 0
ORDER BY id ASC
LIMIT #{pagesize}
@@ -244,20 +242,32 @@
UPDATE xxl_job_log
SET
- alarm_status = #{newAlarmStatus}
- WHERE id= #{logId} AND alarm_status = #{oldAlarmStatus}
+ `alarm_status` = #{newAlarmStatus}
+ WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
SELECT
- t.id
+ t.id
FROM
- xxl_job_log t
- LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
+ xxl_job_log t
+ LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
WHERE
- t.trigger_code = 200
- AND t.handle_code = 0
- AND t.trigger_time #{losedTime}
- AND t2.id IS NULL;
+ t.trigger_code = 200
+ AND t.handle_code = 0
+ AND t.trigger_time #{losedTime}
+ AND t2.id IS NULL;
-
+
+
+
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogReportMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogReportMapper.xml
index 29bcaabf3..6f191b2dd 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogReportMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogReportMapper.xml
@@ -1,14 +1,14 @@
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
-
+
-
-
+
+
@@ -19,30 +19,30 @@
t.fail_count
-
+
INSERT INTO xxl_job_log_report (
- trigger_day,
- running_count,
- suc_count,
- fail_count
+ `trigger_day`,
+ `running_count`,
+ `suc_count`,
+ `fail_count`
) VALUES (
- #{triggerDay},
- #{runningCount},
- #{sucCount},
- #{failCount}
+ #{triggerDay},
+ #{runningCount},
+ #{sucCount},
+ #{failCount}
);
- UPDATE xxl_job_log_report
- SET running_count = #{runningCount},
- suc_count = #{sucCount},
- fail_count = #{failCount}
- WHERE trigger_day = #{triggerDay}
-
+ UPDATE xxl_job_log_report
+ SET `running_count` = #{runningCount},
+ `suc_count` = #{sucCount},
+ `fail_count` = #{failCount}
+ WHERE `trigger_day` = #{triggerDay}
+
SELECT
@@ -53,10 +53,10 @@
SELECT
- SUM(running_count) running_count,
- SUM(suc_count) suc_count,
- SUM(fail_count) fail_count
+ SUM(running_count) running_count,
+ SUM(suc_count) suc_count,
+ SUM(fail_count) fail_count
FROM xxl_job_log_report AS t
-
+
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
index 1d895db1f..13221b9f0 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
@@ -1,13 +1,13 @@
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
-
-
-
+
+
+
@@ -22,10 +22,10 @@
SELECT t.id
FROM xxl_job_registry AS t
- WHERE t.update_time #{expiredTime}
+ WHERE t.update_time DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
-
+
DELETE FROM xxl_job_registry
WHERE id in
@@ -36,27 +36,36 @@
SELECT
FROM xxl_job_registry AS t
- WHERE t.update_time > #{expiredTime}
+ WHERE t.update_time ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
-
- UPDATE xxl_job_registry
- SET update_time = #{updateTime}
- WHERE registry_group = #{registryGroup}
- AND registry_key = #{registryKey}
- AND registry_value = #{registryValue}
-
+
+ INSERT INTO xxl_job_registry( `registry_group` , `registry_key` , `registry_value`, `update_time`)
+ VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, #{updateTime})
+ ON DUPLICATE KEY UPDATE
+ `update_time` = #{updateTime}
+
-
- INSERT INTO xxl_job_registry( registry_group , registry_key , registry_value, update_time)
- VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, #{updateTime})
-
+
DELETE FROM xxl_job_registry
WHERE registry_group = #{registryGroup}
- AND registry_key = #{registryKey}
- AND registry_value = #{registryValue}
+ AND registry_key = #{registryKey}
+ AND registry_value = #{registryValue}
-
+
\ No newline at end of file
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js b/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js
index 223937224..3922d7cd1 100755
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen.js
@@ -258,24 +258,27 @@
var weekly3 = $("",{"class":"line"});
$("",{type : "radio", value : "3", name : "week"}).appendTo(weekly3);
- $(weekly3).append("周期 从星期");
+ $(weekly3).append("周期 每周第");
$("",{type : "text", id : "weekStart_0", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3);
- $(weekly3).append("-");
+ $(weekly3).append("天-第");
$("",{type : "text", id : "weekEnd_0", value : "2", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly3);
+ $(weekly3).append("天");
$(weekly3).appendTo(weeklyTab);
var weekly4 = $("",{"class":"line"});
$("",{type : "radio", value : "4", name : "week"}).appendTo(weekly4);
- $(weekly4).append("第");
+ $(weekly4).append("从第");
$("",{type : "text", id : "weekStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4);
- $(weekly4).append("周的星期");
+ $(weekly4).append("天开始,间隔");
$("",{type : "text", id : "weekEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4);
+ $(weekly4).append("天执行一次");
$(weekly4).appendTo(weeklyTab);
var weekly5 = $("",{"class":"line"});
$("",{type : "radio", value : "5", name : "week"}).appendTo(weekly5);
- $(weekly5).append("本月最后一个星期");
+ $(weekly5).append("本月最后一周的第");
$("",{type : "text", id : "weekStart_2", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly5);
+ $(weekly5).append("天");
$(weekly5).appendTo(weeklyTab);
var weekly6 = $("",{"class":"line"});
@@ -283,7 +286,7 @@
$(weekly6).append("指定");
$(weekly6).appendTo(weeklyTab);
- $(weeklyTab).append('1234567
');
+ $(weeklyTab).append('周日周一周二周三周四周五周六
');
$("",{type : "hidden", id : "weekHidden"}).appendTo(weeklyTab);
$(weeklyTab).appendTo(tabContent);
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js b/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js
index cbf84ee3f..0e2335d55 100755
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/static/plugins/cronGen/cronGen_en.js
@@ -268,7 +268,7 @@
$("",{type : "radio", value : "4", name : "week"}).appendTo(weekly4);
$(weekly4).append("The");
$("",{type : "text", id : "weekStart_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4);
- $(weekly4).append("th week, and day ");
+ $(weekly4).append("th week, once every ");
$("",{type : "text", id : "weekEnd_1", value : "1", style:"width:35px; height:20px; text-align: center; margin: 0 3px;"}).appendTo(weekly4);
$(weekly4).appendTo(weeklyTab);
@@ -283,7 +283,7 @@
$(weekly6).append("specify");
$(weekly6).appendTo(weeklyTab);
- $(weeklyTab).append('1234567
');
+ $(weeklyTab).append('SUNMONTUEWEDTHUFRISAT
');
$("",{type : "hidden", id : "weekHidden"}).appendTo(weeklyTab);
$(weeklyTab).appendTo(tabContent);
diff --git a/pigx-visual/pigx-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl b/pigx-visual/pigx-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl
index a386b2883..c6d7c136a 100644
--- a/pigx-visual/pigx-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl
+++ b/pigx-visual/pigx-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl
@@ -59,7 +59,7 @@
<#list jobLogGlues as glue>
- <#list GlueTypeEnum as item><#if item == glue.glueType>${item.desc}#if>#list>: ${glue.glueRemark}
+ ${glue.addTime?string["yyyy-MM-dd HH:mm:ss"]}: ${glue.glueRemark}
diff --git a/pom.xml b/pom.xml
index ebd3f4e8b..b13d8dc87 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,7 +54,7 @@
2.12.6
2.0.0
1.12.261
- 3.0.0
+ 3.1.1
registry.cn-hangzhou.aliyuncs.com
http://127.0.0.1:2375
pigcloudx