diff --git a/docs/storm-sql-example.md b/docs/storm-sql-example.md
index fbd53185fc8..0d68d7f67fb 100644
--- a/docs/storm-sql-example.md
+++ b/docs/storm-sql-example.md
@@ -243,9 +243,6 @@ The implementation of GetTime2 is here:
```
package org.apache.storm.sql.runtime.functions.scalar.datetime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
public class GetTime2 {
public static Long evaluate(String dateString, String dateFormat) {
try {
diff --git a/integration-test/pom.xml b/integration-test/pom.xml
index c5e0ce1d01e..d54a4ff2f67 100644
--- a/integration-test/pom.xml
+++ b/integration-test/pom.xml
@@ -59,10 +59,6 @@
7.10.2
test
-
- joda-time
- joda-time
-
org.apache.storm
storm-client
diff --git a/integration-test/src/main/java/org/apache/storm/st/utils/TimeUtil.java b/integration-test/src/main/java/org/apache/storm/st/utils/TimeUtil.java
index e43fb05e0c5..887ff14e624 100644
--- a/integration-test/src/main/java/org/apache/storm/st/utils/TimeUtil.java
+++ b/integration-test/src/main/java/org/apache/storm/st/utils/TimeUtil.java
@@ -17,10 +17,11 @@
package org.apache.storm.st.utils;
+import java.time.Duration;
+import java.time.ZonedDateTime;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.exception.ExceptionUtils;
-import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,13 +44,13 @@ public static void sleepMilliSec(int milliSec) {
}
}
- public static DateTime floor(DateTime dateTime, int sec) {
- long modValue = dateTime.getMillis() % (1000 * sec);
- return dateTime.minus(modValue);
+ public static ZonedDateTime floor(ZonedDateTime dateTime, int sec) {
+ long modValue = dateTime.toInstant().toEpochMilli() % (1000 * sec);
+ return dateTime.minus(Duration.ofMillis(modValue));
}
- public static DateTime ceil(DateTime dateTime, int sec) {
- long modValue = dateTime.getMillis() % (1000 * sec);
- return dateTime.minus(modValue).plusSeconds(sec);
+ public static ZonedDateTime ceil(ZonedDateTime dateTime, int sec) {
+ long modValue = dateTime.toInstant().toEpochMilli() % (1000 * sec);
+ return dateTime.minus(Duration.ofMillis(modValue)).plusSeconds(sec);
}
}
diff --git a/integration-test/src/test/java/org/apache/storm/st/tests/window/WindowVerifier.java b/integration-test/src/test/java/org/apache/storm/st/tests/window/WindowVerifier.java
index b59a0ceebff..fda6d44c97c 100644
--- a/integration-test/src/test/java/org/apache/storm/st/tests/window/WindowVerifier.java
+++ b/integration-test/src/test/java/org/apache/storm/st/tests/window/WindowVerifier.java
@@ -17,6 +17,8 @@
package org.apache.storm.st.tests.window;
import java.io.IOException;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.storm.st.topology.TestableTopology;
@@ -27,8 +29,6 @@
import org.apache.storm.st.wrapper.DecoratedLogLine;
import org.apache.storm.st.wrapper.TopoWrap;
import org.apache.storm.thrift.TException;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,8 +100,11 @@ public void runAndVerifyTime(int windowSec, int slideSec, TestableTopology testa
final List allBoltLogLines = topo.getDeserializedDecoratedLogLines(boltName, TimeDataWindow::fromJson);
assertTrue(allBoltLogLines.size() >= minBoltEmits,
"Expecting min " + minBoltEmits + " bolt emits, found: " + allBoltLogLines.size() + " \n\t" + allBoltLogLines);
-
- final DateTime firstWindowEndTime = TimeUtil.ceil(new DateTime(allSpoutLogLines.get(0).getDate()).withZone(DateTimeZone.UTC), slideSec);
+
+ ZonedDateTime firstWindowEndTime = TimeUtil.ceil(
+ ZonedDateTime.ofInstant(allSpoutLogLines.get(0).getDate().toInstant(), ZoneOffset.UTC),
+ slideSec
+ );
final int numberOfWindows = allBoltLogLines.size();
/*
* Windows should be aligned to the slide size, starting at firstWindowEndTime - windowSec.
@@ -109,15 +112,15 @@ public void runAndVerifyTime(int windowSec, int slideSec, TestableTopology testa
* This checks that the partitioned spout emits fall in the expected windows, based on the logs from the spout and bolt.
*/
for (int i = 0; i < numberOfWindows; ++i) {
- final DateTime windowEnd = firstWindowEndTime.plusSeconds(i * slideSec);
- final DateTime windowStart = windowEnd.minusSeconds(windowSec);
+ final ZonedDateTime windowEnd = firstWindowEndTime.plusSeconds(i * slideSec);
+ final ZonedDateTime windowStart = windowEnd.minusSeconds(windowSec);
LOG.info("Comparing window: " + windowStart + " to " + windowEnd + " iter " + (i+1) + "/" + numberOfWindows);
final List expectedSpoutEmitsInWindow = allSpoutLogLines.stream()
.filter(spoutLog -> {
- DateTime spoutLogTime = new DateTime(spoutLog.getDate());
+ final ZonedDateTime spoutLogTime = spoutLog.getDate().toInstant().atZone(ZoneOffset.UTC);
//The window boundaries are )windowStart, windowEnd)
- return spoutLogTime.isAfter(windowStart) && spoutLogTime.isBefore(windowEnd.plusMillis(1));
+ return spoutLogTime.isAfter(windowStart) && spoutLogTime.isBefore(windowEnd.plusNanos(1_000_000));
}).collect(Collectors.toList());
TimeDataWindow expectedWindow = new TimeDataWindow(expectedSpoutEmitsInWindow);
diff --git a/integration-test/src/test/java/org/apache/storm/st/wrapper/DecoratedLogLine.java b/integration-test/src/test/java/org/apache/storm/st/wrapper/DecoratedLogLine.java
index f9c4c85d474..473e0237c09 100644
--- a/integration-test/src/test/java/org/apache/storm/st/wrapper/DecoratedLogLine.java
+++ b/integration-test/src/test/java/org/apache/storm/st/wrapper/DecoratedLogLine.java
@@ -19,11 +19,10 @@
import org.apache.storm.st.utils.AssertUtil;
import org.apache.commons.lang.StringUtils;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
import org.apache.storm.st.utils.StringDecorator;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
@@ -32,22 +31,22 @@
* This provides easy access to the log line timestamp and data.
*/
public class DecoratedLogLine implements Comparable {
- private final DateTime logDate;
+ private final ZonedDateTime logDate;
private final String data;
private static final int DATE_LEN = "2016-05-04 23:38:10.702".length(); //format of date in worker logs
- private static final DateTimeFormatter DATE_FORMAT = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");
+ private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
public DecoratedLogLine(String logLine) {
final List splitOnDecorator = Arrays.asList(StringDecorator.split2(StringUtils.strip(logLine)));
AssertUtil.assertTwoElements(splitOnDecorator);
- this.logDate = DATE_FORMAT.parseDateTime(splitOnDecorator.get(0).substring(0, DATE_LEN));
+ this.logDate = ZonedDateTime.parse(splitOnDecorator.get(0).substring(0, DATE_LEN), DATE_FORMAT);
this.data = splitOnDecorator.get(1);
}
@Override
public String toString() {
return "LogData{" +
- "logDate=" + DATE_FORMAT.print(logDate) +
+ "logDate=" + DATE_FORMAT.format(logDate) +
", data='" + getData() + '\'' +
'}';
}
@@ -61,7 +60,7 @@ public String getData() {
return data;
}
- public DateTime getLogDate() {
+ public ZonedDateTime getLogDate() {
return logDate;
}
}
diff --git a/storm-core/pom.xml b/storm-core/pom.xml
index 8b6640822a0..2effcf6385e 100644
--- a/storm-core/pom.xml
+++ b/storm-core/pom.xml
@@ -155,10 +155,6 @@
org.slf4j
slf4j-api
-
- joda-time
- joda-time
-
org.eclipse.jetty
jetty-server