Deprecate joda-time
- ref:
http://blog.joda.org/2014/11/converting-from-joda-time-to-javatime.html
Change-Id: I1115e8053f601e78cb933ccbfa664ff8787d2da1
diff --git a/core/api/pom.xml b/core/api/pom.xml
index f4d65ca..290c345 100644
--- a/core/api/pom.xml
+++ b/core/api/pom.xml
@@ -34,6 +34,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
+ <version>2.9.3</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
index e4cf7ec..1a75e5f 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.cluster;
+import java.time.Instant;
+import java.util.Optional;
import java.util.Set;
import org.joda.time.DateTime;
@@ -72,6 +74,27 @@
* @param nodeId controller node identifier
* @return system time when the availability state was last updated.
*/
- DateTime getLastUpdated(NodeId nodeId);
+ default Instant getLastUpdatedInstant(NodeId nodeId) {
+ return Optional.ofNullable(getLastUpdated(nodeId))
+ .map(DateTime::getMillis)
+ .map(Instant::ofEpochMilli)
+ .orElse(null);
+ }
+
+ /**
+ * Returns the system time when the availability state was last updated.
+ *
+ * @param nodeId controller node identifier
+ * @return system time when the availability state was last updated.
+ *
+ * @deprecated in 1.12.0
+ */
+ @Deprecated
+ default DateTime getLastUpdated(NodeId nodeId) {
+ return Optional.ofNullable(getLastUpdatedInstant(nodeId))
+ .map(Instant::toEpochMilli)
+ .map(DateTime::new)
+ .orElse(null);
+ }
}
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
index 7154c78..dfe0b23 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
@@ -20,6 +20,8 @@
import org.onosproject.core.Version;
import org.onosproject.store.Store;
+import java.time.Instant;
+import java.util.Optional;
import java.util.Set;
/**
@@ -78,7 +80,28 @@
* @param nodeId controller node identifier
* @return system time when the availability state was last updated.
*/
- DateTime getLastUpdated(NodeId nodeId);
+ default Instant getLastUpdatedInstant(NodeId nodeId) {
+ return Optional.ofNullable(getLastUpdated(nodeId))
+ .map(DateTime::getMillis)
+ .map(Instant::ofEpochMilli)
+ .orElse(null);
+ }
+
+ /**
+ * Returns the system when the availability state was last updated.
+ *
+ * @param nodeId controller node identifier
+ * @return system time when the availability state was last updated.
+ *
+ * @deprecated in 1.12.0
+ */
+ @Deprecated
+ default DateTime getLastUpdated(NodeId nodeId) {
+ return Optional.ofNullable(getLastUpdatedInstant(nodeId))
+ .map(Instant::toEpochMilli)
+ .map(DateTime::new)
+ .orElse(null);
+ }
/**
* Adds a new controller node to the cluster.
diff --git a/core/api/src/main/java/org/onosproject/event/AbstractEvent.java b/core/api/src/main/java/org/onosproject/event/AbstractEvent.java
index 2d810a3..754ecbb 100644
--- a/core/api/src/main/java/org/onosproject/event/AbstractEvent.java
+++ b/core/api/src/main/java/org/onosproject/event/AbstractEvent.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.event;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import static com.google.common.base.MoreObjects.toStringHelper;
@@ -70,7 +70,7 @@
@Override
public String toString() {
return toStringHelper(this)
- .add("time", new LocalDateTime(time))
+ .add("time", Tools.defaultOffsetDataTime(time))
.add("type", type())
.add("subject", subject())
.toString();
diff --git a/core/api/src/main/java/org/onosproject/mastership/MastershipEvent.java b/core/api/src/main/java/org/onosproject/mastership/MastershipEvent.java
index 4242e61..db5ba74 100644
--- a/core/api/src/main/java/org/onosproject/mastership/MastershipEvent.java
+++ b/core/api/src/main/java/org/onosproject/mastership/MastershipEvent.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.mastership;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import org.onosproject.cluster.RoleInfo;
import org.onosproject.event.AbstractEvent;
import org.onosproject.net.DeviceId;
@@ -114,7 +114,7 @@
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("time", new LocalDateTime(time()))
+ .add("time", Tools.defaultOffsetDataTime(time()))
.add("type", type())
.add("subject", subject())
.add("roleInfo", roleInfo)
diff --git a/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java b/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java
index e94e0d9..ee1f03c 100644
--- a/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.config;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import org.onosproject.event.AbstractEvent;
import java.util.Optional;
@@ -141,7 +141,7 @@
@Override
public String toString() {
return toStringHelper(this)
- .add("time", new LocalDateTime(time()))
+ .add("time", Tools.defaultOffsetDataTime(time()))
.add("type", type())
.add("config", config())
.add("prevConfig", prevConfig())
diff --git a/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java b/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
index 7ebb041..16e9d25 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.device;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import org.onosproject.event.AbstractEvent;
import org.onosproject.net.Device;
import org.onosproject.net.Port;
@@ -132,7 +132,7 @@
return super.toString();
}
return toStringHelper(this)
- .add("time", new LocalDateTime(time()))
+ .add("time", Tools.defaultOffsetDataTime(time()))
.add("type", type())
.add("subject", subject())
.add("port", port)
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostEvent.java b/core/api/src/main/java/org/onosproject/net/host/HostEvent.java
index 318c3ff..0ed491f 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostEvent.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.host;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import org.onosproject.event.AbstractEvent;
import org.onosproject.net.Host;
@@ -104,7 +104,7 @@
@Override
public String toString() {
return toStringHelper(this)
- .add("time", new LocalDateTime(time()))
+ .add("time", Tools.defaultOffsetDataTime(time()))
.add("type", type())
.add("subject", subject())
.add("prevSubject", prevSubject())
diff --git a/core/api/src/main/java/org/onosproject/net/intf/InterfaceEvent.java b/core/api/src/main/java/org/onosproject/net/intf/InterfaceEvent.java
index 1e7d9ba..9d26208 100644
--- a/core/api/src/main/java/org/onosproject/net/intf/InterfaceEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/intf/InterfaceEvent.java
@@ -16,7 +16,7 @@
package org.onosproject.net.intf;
-import org.joda.time.LocalDateTime;
+import org.onlab.util.Tools;
import org.onosproject.event.AbstractEvent;
import static com.google.common.base.MoreObjects.toStringHelper;
@@ -106,7 +106,7 @@
return super.toString();
}
return toStringHelper(this)
- .add("time", new LocalDateTime(time()))
+ .add("time", Tools.defaultOffsetDataTime(time()))
.add("type", type())
.add("subject", subject())
.add("prevSubject", prevSubject)
diff --git a/core/api/src/main/java/org/onosproject/store/service/Versioned.java b/core/api/src/main/java/org/onosproject/store/service/Versioned.java
index a3f555e..5033240 100644
--- a/core/api/src/main/java/org/onosproject/store/service/Versioned.java
+++ b/core/api/src/main/java/org/onosproject/store/service/Versioned.java
@@ -18,8 +18,8 @@
import java.util.function.Function;
-import org.joda.time.DateTime;
import org.onlab.util.ByteArraySizeHashPrinter;
+import org.onlab.util.Tools;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
@@ -143,7 +143,7 @@
return MoreObjects.toStringHelper(this)
.add("value", value instanceof byte[] ? new ByteArraySizeHashPrinter((byte[]) value) : value)
.add("version", version)
- .add("creationTime", new DateTime(creationTime))
+ .add("creationTime", Tools.defaultOffsetDataTime(creationTime))
.toString();
}
}
diff --git a/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java b/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
index 307de2e..78f6b19 100644
--- a/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
+++ b/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
@@ -19,7 +19,7 @@
import java.util.Objects;
-import org.joda.time.DateTime;
+import org.onlab.util.Tools;
import org.onosproject.store.Timestamp;
import com.google.common.collect.ComparisonChain;
@@ -69,7 +69,7 @@
@Override
public String toString() {
- return new DateTime(unixTimestamp).toString();
+ return Tools.defaultOffsetDataTime(unixTimestamp).toString();
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java
index f2dba03..adf8ead 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/TimeFormatter.java
@@ -16,13 +16,21 @@
package org.onosproject.ui.table.cell;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
+import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_AMPM;
+import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
+import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalAccessor;
import java.util.Locale;
+import org.joda.time.DateTimeZone;
+
/**
* Formats time values using {@link DateTimeFormatter}.
*/
@@ -38,7 +46,19 @@
* Constructs a time formatter that uses the default locale and timezone.
*/
public TimeFormatter() {
- dtf = DateTimeFormat.longTime();
+ dtf = new DateTimeFormatterBuilder()
+ .appendValue(CLOCK_HOUR_OF_AMPM)
+ .appendLiteral(':')
+ .appendValue(MINUTE_OF_HOUR, 2)
+ .optionalStart()
+ .appendLiteral(':')
+ .appendValue(SECOND_OF_MINUTE, 2)
+ .appendLiteral(' ')
+ .appendText(ChronoField.AMPM_OF_DAY)
+ .optionalStart()
+ .appendLiteral(' ')
+ .appendOffset("+HH:MM", "+00:00")
+ .toFormatter();
}
/**
@@ -58,14 +78,33 @@
* @param zone time zone to use
* @return self, for chaining
*/
- public TimeFormatter withZone(DateTimeZone zone) {
+ public TimeFormatter withZone(ZoneId zone) {
dtf = dtf.withZone(zone);
return this;
}
+ /**
+ * Sets the time zone to use for formatting the time.
+ *
+ * @param zone time zone to use
+ * @return self, for chaining
+ *
+ * @deprecated in 1.12.0
+ */
+ @Deprecated
+ public TimeFormatter withZone(DateTimeZone zone) {
+ return withZone(zone.toTimeZone().toZoneId());
+ }
+
@Override
protected String nonNullFormat(Object value) {
- return dtf.print((DateTime) value);
+ if (value instanceof TemporalAccessor) {
+ return dtf.format((TemporalAccessor) value);
+ } else if (value instanceof org.joda.time.DateTime) {
+ return dtf.format(Instant.ofEpochMilli(((org.joda.time.DateTime) value).getMillis()));
+ }
+ // should never reach here
+ return String.valueOf(value);
}
}
diff --git a/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java b/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
index cc6916f..bc40f67 100644
--- a/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
@@ -15,9 +15,9 @@
*/
package org.onosproject.cluster;
+import java.time.Instant;
import java.util.Set;
-import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
import com.google.common.collect.ImmutableSet;
@@ -56,7 +56,7 @@
}
@Override
- public DateTime getLastUpdated(NodeId nodeId) {
+ public Instant getLastUpdatedInstant(NodeId nodeId) {
return null;
}
diff --git a/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java b/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java
index 4f73490..7517aac 100644
--- a/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/table/cell/TimeFormatterTest.java
@@ -16,14 +16,15 @@
package org.onosproject.ui.table.cell;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
import org.junit.Test;
import org.onosproject.ui.table.CellFormatter;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
import java.util.Locale;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.Matchers.isOneOf;
+import static org.junit.Assert.assertThat;
/**
* Unit tests for {@link TimeFormatter}.
@@ -31,9 +32,9 @@
public class TimeFormatterTest {
private static final Locale LOCALE = Locale.ENGLISH;
- private static final DateTimeZone ZONE = DateTimeZone.UTC;
+ private static final ZoneOffset ZONE = ZoneOffset.UTC;
- private static final DateTime TIME = new DateTime(2015, 5, 4, 15, 30, ZONE);
+ private static final OffsetDateTime TIME = OffsetDateTime.of(2015, 5, 4, 15, 30, 0, 0, ZONE);
private static final String EXP_ZONE_NAME = "3:30:00 PM UTC";
private static final String EXP_ZONE_OFFSET = "3:30:00 PM +00:00";
@@ -45,7 +46,6 @@
@Test
public void basic() {
- assertTrue("wrong format", (EXP_ZONE_NAME.equals(fmt.format(TIME)) ||
- EXP_ZONE_OFFSET.equals(fmt.format(TIME))));
+ assertThat(fmt.format(TIME), isOneOf(EXP_ZONE_OFFSET, EXP_ZONE_NAME));
}
}
diff --git a/core/common/BUCK b/core/common/BUCK
index 46d519d..56c6970 100644
--- a/core/common/BUCK
+++ b/core/common/BUCK
@@ -4,7 +4,6 @@
'//lib:METRICS',
'//incubator/api:onos-incubator-api',
'//core/api:onos-api',
- '//lib:joda-time',
]
TEST_DEPS = [
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
index fb50123..4a4fdaf 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
@@ -23,7 +23,6 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
import org.onosproject.cluster.ClusterEvent;
import org.onosproject.cluster.ClusterStore;
@@ -41,6 +40,7 @@
import org.onosproject.store.AbstractStore;
import org.slf4j.Logger;
+import java.time.Instant;
import java.util.Set;
import java.util.function.Function;
@@ -64,7 +64,7 @@
private ControllerNode instance;
- private final DateTime creationTime = DateTime.now();
+ private final Instant creationTime = Instant.now();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected EventDeliveryService eventDispatcher;
@@ -123,7 +123,7 @@
}
@Override
- public DateTime getLastUpdated(NodeId nodeId) {
+ public Instant getLastUpdatedInstant(NodeId nodeId) {
return creationTime;
}
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleMastershipStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleMastershipStore.java
index e533f23..31480e8 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleMastershipStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleMastershipStore.java
@@ -19,6 +19,7 @@
import static org.onosproject.mastership.MastershipEvent.Type.MASTER_CHANGED;
import static org.slf4j.LoggerFactory.getLogger;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -36,7 +37,6 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
import org.onosproject.cluster.ClusterEventListener;
import org.onosproject.cluster.ClusterService;
@@ -97,7 +97,7 @@
clusterService = new ClusterService() {
- private final DateTime creationTime = DateTime.now();
+ private final Instant creationTime = Instant.now();
@Override
public ControllerNode getLocalNode() {
@@ -135,7 +135,7 @@
}
@Override
- public DateTime getLastUpdated(NodeId nodeId) {
+ public Instant getLastUpdatedInstant(NodeId nodeId) {
return creationTime;
}
diff --git a/core/net/BUCK b/core/net/BUCK
index 26b898d..267c70a 100644
--- a/core/net/BUCK
+++ b/core/net/BUCK
@@ -9,7 +9,6 @@
'//incubator/net:onos-incubator-net',
'//incubator/store:onos-incubator-store',
'//core/store/serializers:onos-core-serializers',
- '//lib:joda-time',
]
TEST_DEPS = [
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ClusterManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/ClusterManager.java
index fc3d802..92a3894 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/ClusterManager.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ClusterManager.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.cluster.impl;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -31,7 +32,6 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.apache.karaf.system.SystemService;
-import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
import org.onlab.util.Tools;
import org.onosproject.cluster.ClusterAdminService;
@@ -147,9 +147,9 @@
}
@Override
- public DateTime getLastUpdated(NodeId nodeId) {
+ public Instant getLastUpdatedInstant(NodeId nodeId) {
checkPermission(CLUSTER_READ);
- return store.getLastUpdated(nodeId);
+ return store.getLastUpdatedInstant(nodeId);
}
@Override
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
index bbf6d39..eb477be 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -25,7 +25,6 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.joda.time.DateTime;
import org.onlab.util.KryoNamespace;
import org.onlab.util.Tools;
import org.onosproject.cluster.ClusterService;
@@ -74,6 +73,7 @@
import org.onosproject.store.service.Serializer;
import org.slf4j.Logger;
+import java.time.Instant;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
@@ -180,9 +180,9 @@
*/
private class LocalStatus {
boolean connected;
- DateTime dateTime;
+ Instant dateTime;
- public LocalStatus(boolean b, DateTime now) {
+ public LocalStatus(boolean b, Instant now) {
connected = b;
dateTime = now;
}
@@ -333,7 +333,7 @@
if (ls == null) {
return "No Record";
}
- String timeAgo = Tools.timeAgo(ls.dateTime.getMillis());
+ String timeAgo = Tools.timeAgo(ls.dateTime.toEpochMilli());
return (ls.connected) ? "connected " + timeAgo : "disconnected " + timeAgo;
}
@@ -508,7 +508,7 @@
checkNotNull(deviceDescription, DEVICE_DESCRIPTION_NULL);
checkValidity();
- deviceLocalStatus.put(deviceId, new LocalStatus(true, DateTime.now()));
+ deviceLocalStatus.put(deviceId, new LocalStatus(true, Instant.now()));
BasicDeviceConfig cfg = networkConfigService.getConfig(deviceId, BasicDeviceConfig.class);
if (!isAllowed(cfg)) {
@@ -564,7 +564,7 @@
public void deviceDisconnected(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkValidity();
- deviceLocalStatus.put(deviceId, new LocalStatus(false, DateTime.now()));
+ deviceLocalStatus.put(deviceId, new LocalStatus(false, Instant.now()));
log.info("Device {} disconnected from this node", deviceId);
List<PortDescription> descs = store.getPortDescriptions(provider().id(), deviceId)
diff --git a/core/store/dist/BUCK b/core/store/dist/BUCK
index 3483f64..b6be5ec 100644
--- a/core/store/dist/BUCK
+++ b/core/store/dist/BUCK
@@ -14,7 +14,6 @@
'//lib:netty-resolver',
'//lib:commons-math3',
'//incubator/api:onos-incubator-api',
- '//lib:joda-time',
]
TEST_DEPS = [
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
index 34b2f0b..b106763 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
@@ -27,7 +27,6 @@
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
-import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
import org.onlab.util.KryoNamespace;
import org.onosproject.cfg.ConfigProperty;
@@ -50,6 +49,7 @@
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
+import java.time.Instant;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -106,7 +106,7 @@
private final Map<NodeId, ControllerNode> allNodes = Maps.newConcurrentMap();
private final Map<NodeId, State> nodeStates = Maps.newConcurrentMap();
private final Map<NodeId, Version> nodeVersions = Maps.newConcurrentMap();
- private final Map<NodeId, DateTime> nodeLastUpdatedTimes = Maps.newConcurrentMap();
+ private final Map<NodeId, Instant> nodeLastUpdatedTimes = Maps.newConcurrentMap();
private ScheduledExecutorService heartBeatSender = Executors.newSingleThreadScheduledExecutor(
groupedThreads("onos/cluster/membership", "heartbeat-sender", log));
@@ -273,7 +273,7 @@
if (newVersion != null) {
nodeVersions.put(nodeId, newVersion);
}
- nodeLastUpdatedTimes.put(nodeId, DateTime.now());
+ nodeLastUpdatedTimes.put(nodeId, Instant.now());
notifyChange(nodeId, currentState, newState, currentVersion, newVersion);
}
}
@@ -357,7 +357,7 @@
}
@Override
- public DateTime getLastUpdated(NodeId nodeId) {
+ public Instant getLastUpdatedInstant(NodeId nodeId) {
return nodeLastUpdatedTimes.get(nodeId);
}