aboutsummaryrefslogtreecommitdiffstats
path: root/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-06 11:28:53 -0400
committerJim Hahn <jrh3@att.com>2021-05-06 15:26:24 -0400
commit1d0aaaa5b31719c1718700bb0d1a99c413fd513c (patch)
treebd2687f1d38f3e3c4e53a68695c8c91c6866468e /common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
parent3b00f1c32b89282dcbb74d3d3645e263f005319e (diff)
Fix sonars in policy-common
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java')
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
index 47c05041..e457f5f3 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -143,7 +143,7 @@ public class OnapLoggingContext {
* with key "TransactionElapsedTime".
*/
public void transactionEnded() {
- Instant transactionEndTime = Instant.now();
+ var transactionEndTime = Instant.now();
setTransactionEndTimestamp(transactionEndTime);
setTransactionElapsedTime(transactionEndTime);
}
@@ -163,7 +163,7 @@ public class OnapLoggingContext {
* "MetricElapsedTime".
*/
public void metricEnded() {
- Instant metricEndTime = Instant.now();
+ var metricEndTime = Instant.now();
setMetricEndTimestamp(metricEndTime);
setMetricElapsedTime(metricEndTime);
}
@@ -449,7 +449,7 @@ public class OnapLoggingContext {
* @param transactionStartTime transaction start time
*/
public void setTransactionBeginTimestamp(Instant transactionStartTime) {
- SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
+ var sdf = new SimpleDateFormat(TIME_FORMAT);
context.put(TRANSACTION_BEGIN_TIME_STAMP, sdf.format(Date.from(transactionStartTime)));
}
@@ -468,7 +468,7 @@ public class OnapLoggingContext {
* @param transactionEndTime transaction end time
*/
public void setTransactionEndTimestamp(Instant transactionEndTime) {
- SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
+ var sdf = new SimpleDateFormat(TIME_FORMAT);
context.put(TRANSACTION_END_TIME_STAMP, sdf.format(Date.from(transactionEndTime)));
}
@@ -510,7 +510,7 @@ public class OnapLoggingContext {
* @param metricStartTime metric start time
*/
public void setMetricBeginTimestamp(Instant metricStartTime) {
- SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
+ var sdf = new SimpleDateFormat(TIME_FORMAT);
context.put(METRIC_BEGIN_TIME_STAMP, sdf.format(Date.from(metricStartTime)));
}
@@ -529,7 +529,7 @@ public class OnapLoggingContext {
* @param metricEndTime metric end time
*/
public void setMetricEndTimestamp(Instant metricEndTime) {
- SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
+ var sdf = new SimpleDateFormat(TIME_FORMAT);
context.put(METRIC_END_TIME_STAMP, sdf.format(Date.from(metricEndTime)));
}