diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2017-05-08 12:59:44 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-05-16 18:13:41 +0000 |
commit | 753cb638fcb58f355f2c979e9e0a43cba2832984 (patch) | |
tree | 55526dce196663d6c5c4265e504882e3deec2cc2 /appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main | |
parent | f16391cacb2e91063bbe9ad66cb2310855c93695 (diff) |
Migrate to Java 8 Time API
Migrate the uses of the old Date class in CommonHeader,
RuntimeContext, QueueMessage, and TransactionRecord to
Java 8 Time API.
Change-Id: I3b0c18b2e63cdab06e37587d2010cb7f626a0396
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main')
-rw-r--r-- | appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java index 0948b2b4d..d9df1dd23 100644 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java @@ -25,7 +25,8 @@ package org.openecomp.appc.executor.impl; -import java.util.Date; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; import org.apache.commons.lang.ObjectUtils; @@ -107,9 +108,9 @@ public class CommandExecutorImpl implements CommandExecutor { } private long getRemainingTTL(RuntimeContext request) { - Date requestTimestamp = request.getRequestContext().getCommonHeader().getTimeStamp(); + Instant requestTimestamp = request.getRequestContext().getCommonHeader().getTimeStamp(); int ttl = request.getRequestContext().getCommonHeader().getFlags().getTtl(); - return ttl*1000 + requestTimestamp.getTime() - System.currentTimeMillis(); + return ChronoUnit.MILLIS.between(Instant.now(), requestTimestamp.plusSeconds(ttl)); } private CommandTask getMessageExecutor(String action){ |