diff --git a/pom.xml b/pom.xml index 49214b9c..9192d76a 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ UTF-8 - 4.5.4 + 4.5.7 0.21.0 2.15.3 5.2.5 @@ -145,6 +145,11 @@ vertx-redis-client ${vertxVersion} + + io.vertx + vertx-json-schema + ${vertxVersion} + org.apache.poi poi diff --git a/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java b/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java index a866978c..b29cd582 100644 --- a/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java +++ b/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java @@ -104,6 +104,13 @@ private void parseField(@Nonnull String rawComponent, @Nonnull Set opti } } + /** + * @since 3.2.4 + */ + public static ParsedCalenderElements parseCalenderToElements(@Nonnull Calendar currentCalendar) { + return new ParsedCalenderElements(currentCalendar); + } + @Nonnull public String getRawCronExpression() { return rawCronExpression; @@ -119,17 +126,21 @@ public static class ParsedCalenderElements { public final int month; public final int weekday; + // debug use + public final int second; + public ParsedCalenderElements(@Nonnull Calendar currentCalendar) { minute = currentCalendar.get(Calendar.MINUTE); hour = currentCalendar.get(Calendar.HOUR_OF_DAY); day = currentCalendar.get(Calendar.DAY_OF_MONTH); month = 1 + currentCalendar.get(Calendar.MONTH);// make JAN 1, ... weekday = currentCalendar.get(Calendar.DAY_OF_WEEK) - 1; // make sunday 0, ... + second = currentCalendar.get(Calendar.SECOND); } @Override public String toString() { - return minute + " " + hour + " " + day + " " + month + " " + weekday; + return "(" + second + ") " + minute + " " + hour + " " + day + " " + month + " " + weekday; } } diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java index 35834fa4..1e5b5d7d 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java @@ -10,6 +10,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonArrayScheme extends JsonValueScheme { private final Map> indexedElementSchemeMap = new LinkedHashMap<>(); private JsonElementScheme defaultElementScheme; diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java index fd19fc7a..87c90b2d 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java @@ -7,6 +7,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonBooleanScheme extends JsonValueScheme { private Boolean expected; diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java index 51d0f274..206873c8 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java @@ -6,6 +6,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public interface JsonElementScheme extends JsonifiableEntity> { static JsonElementScheme fromJsonObject(JsonObject jsonObject) { JsonElementSchemeType scheme_type = JsonElementSchemeType.valueOf(jsonObject.getString("scheme_type")); diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java index bc5f0ceb..66a7c1a4 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java @@ -7,6 +7,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonNullScheme extends JsonValueScheme { public JsonNullScheme() { super(); diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNumberScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNumberScheme.java index 03fd98df..5ea412f7 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNumberScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNumberScheme.java @@ -8,6 +8,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonNumberScheme extends JsonValueScheme { //private boolean withFractions; diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonObjectScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonObjectScheme.java index 64726140..f15e870b 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonObjectScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonObjectScheme.java @@ -9,6 +9,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonObjectScheme extends JsonValueScheme { private final Map> elementSchemeMap = new LinkedHashMap<>(); diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonPlainScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonPlainScheme.java index 520b636e..aafe81c1 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonPlainScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonPlainScheme.java @@ -4,6 +4,7 @@ import javax.annotation.Nonnull; +@Deprecated(since = "3.2.4") public class JsonPlainScheme extends JsonValueScheme { @Override diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonSchemeMismatchException.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonSchemeMismatchException.java index c9b9e463..58f6dead 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonSchemeMismatchException.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonSchemeMismatchException.java @@ -6,6 +6,7 @@ import static io.github.sinri.keel.helper.KeelHelpersInterface.KeelHelpers; +@Deprecated(since = "3.2.4") public class JsonSchemeMismatchException extends Exception { public static final String RuleSchemeError = "SchemeError"; public static final String RuleEmptyArrayNotAllowed = "EmptyArrayNotAllowed"; diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonStringScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonStringScheme.java index a426b0ef..70a847db 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonStringScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonStringScheme.java @@ -8,6 +8,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") public class JsonStringScheme extends JsonValueScheme { private Pattern pattern; diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonValueScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonValueScheme.java index 1e4c402b..3ac056ac 100644 --- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonValueScheme.java +++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonValueScheme.java @@ -7,6 +7,7 @@ /** * @since 2.7 */ +@Deprecated(since = "3.2.4") abstract public class JsonValueScheme implements JsonElementScheme { protected T digested; diff --git a/src/main/java/io/github/sinri/keel/servant/sundial/KeelSundial.java b/src/main/java/io/github/sinri/keel/servant/sundial/KeelSundial.java index 592fc65f..1a2583a3 100644 --- a/src/main/java/io/github/sinri/keel/servant/sundial/KeelSundial.java +++ b/src/main/java/io/github/sinri/keel/servant/sundial/KeelSundial.java @@ -32,10 +32,9 @@ protected KeelEventLogger buildEventLogger() { @Override public void start() throws Exception { - long delaySeconds = 60 - (System.currentTimeMillis() / 1000) % 60; - this.timerID = Keel.getVertx().setPeriodic(delaySeconds, 60_000L, timerID -> { - Calendar calendar = Calendar.getInstance(); - handleEveryMinute(calendar); + int delaySeconds = 61 - KeelCronExpression.parseCalenderToElements(Calendar.getInstance()).second; + this.timerID = Keel.getVertx().setPeriodic(delaySeconds * 1000L, 60_000L, timerID -> { + handleEveryMinute(Calendar.getInstance()); refreshPlans(); }); }