Deprecate joda-time
- ref:
http://blog.joda.org/2014/11/converting-from-joda-time-to-javatime.html
Change-Id: I1115e8053f601e78cb933ccbfa664ff8787d2da1
diff --git a/BUCK b/BUCK
index ae72b22..5942871 100644
--- a/BUCK
+++ b/BUCK
@@ -9,7 +9,6 @@
'//incubator/api:onos-incubator-api',
'//utils/rest:onlab-rest',
'//apps/route-service/api:onos-apps-route-service-api',
- '//lib:joda-time',
]
BUNDLES = [
diff --git a/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java b/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
index 709d05e..5014811 100644
--- a/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
@@ -23,7 +23,6 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import org.joda.time.DateTime;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpPrefix;
@@ -41,6 +40,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -79,7 +79,7 @@
private volatile Status populationStatus;
private ScheduledExecutorService executorService
= newScheduledThreadPool(1, groupedThreads("retryftr", "retry-%d", log));
- private DateTime lastRoutingChange;
+ private Instant lastRoutingChange;
/**
* Represents the default routing population status.
@@ -150,8 +150,8 @@
* @return true if stable
*/
public boolean isRoutingStable() {
- long last = (long) (lastRoutingChange.getMillis() / 1000.0);
- long now = (long) (DateTime.now().getMillis() / 1000.0);
+ long last = (long) (lastRoutingChange.toEpochMilli() / 1000.0);
+ long now = (long) (Instant.now().toEpochMilli() / 1000.0);
log.trace("Routing stable since {}s", now - last);
return (now - last) > STABLITY_THRESHOLD;
}
@@ -173,7 +173,7 @@
* startup or after a configuration event.
*/
public void populateAllRoutingRules() {
- lastRoutingChange = DateTime.now();
+ lastRoutingChange = Instant.now();
statusLock.lock();
try {
if (populationStatus == Status.STARTED) {
@@ -249,7 +249,7 @@
return;
}
- lastRoutingChange = DateTime.now();
+ lastRoutingChange = Instant.now();
statusLock.lock();
try {
if (populationStatus == Status.STARTED) {
@@ -374,7 +374,7 @@
log.warn("Only one event can be handled for link status change .. aborting");
return;
}
- lastRoutingChange = DateTime.now();
+ lastRoutingChange = Instant.now();
executorService.schedule(new UpdateMaps(), UPDATE_INTERVAL,
TimeUnit.SECONDS);
statusLock.lock();