aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java7
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java9
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java10
8 files changed, 23 insertions, 46 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 8d66505c6a..9309f05c40 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -1096,12 +1096,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
return true;
}
- Calendar now = Calendar.getInstance ();
- if (now.after (expires)) {
- return true;
- }
-
- return false;
+ return System.currentTimeMillis() > expires.getTimeInMillis();
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
index 82203d044c..8375b973c9 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
@@ -658,7 +658,11 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
}
public boolean isExpired () {
- return Calendar.getInstance ().after (expires);
+ if (expires == null) {
+ return true;
+ }
+
+ return System.currentTimeMillis() > expires.getTimeInMillis();
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
index 7e388a5ef8..f3281e3f1c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
@@ -585,12 +585,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
return true;
}
- Calendar now = Calendar.getInstance();
- if (now.after(expires)) {
- return true;
- }
-
- return false;
+ return System.currentTimeMillis() > expires.getTimeInMillis();
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index e976419399..64bdc3f269 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -25,7 +25,6 @@ import java.io.StringWriter;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -116,16 +115,14 @@ public class MsoRequest {
MsoRequest (String requestId) {
this.requestId = requestId;
- Calendar startTimeCalendar = Calendar.getInstance ();
- this.startTime = startTimeCalendar.getTimeInMillis ();
+ this.startTime = System.currentTimeMillis();
MsoLogger.setLogContext (requestId, null);
}
MsoRequest () {
- Calendar startTimeCalendar = Calendar.getInstance ();
- this.startTime = startTimeCalendar.getTimeInMillis ();
+ this.startTime = System.currentTimeMillis();
MsoLogger.setLogContext (requestId, null);
}
@@ -522,7 +519,7 @@ public class MsoRequest {
aq.setRequestAction(action.name());
aq.setAction(action.name());
- Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setStartTime (startTimeStamp);
@@ -625,8 +622,7 @@ public class MsoRequest {
aq.setResponseBody (this.responseBody);
aq.setProgress(new Long(100));
- Calendar endTime = Calendar.getInstance ();
- Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
index f35ddfbda8..61f4b9f7cd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
@@ -24,7 +24,6 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.Date;
import javax.ws.rs.core.Response;
@@ -82,8 +81,7 @@ public class NetworkMsoInfraRequest {
NetworkMsoInfraRequest (String requestId) {
this.requestId = requestId;
- Calendar startTimeCalendar = Calendar.getInstance ();
- this.startTime = startTimeCalendar.getTimeInMillis ();
+ this.startTime = System.currentTimeMillis();
MsoLogger.setLogContext (requestId, null);
}
@@ -260,7 +258,7 @@ public class NetworkMsoInfraRequest {
InfraActiveRequests aq = new InfraActiveRequests ();
aq.setRequestId (requestId);
- Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
if (rinfo != null) {
if (rinfo.getAction () != null) {
aq.setAction (rinfo.getAction ().value ());
@@ -320,8 +318,7 @@ public class NetworkMsoInfraRequest {
aq.setStatusMessage (this.errorMessage);
aq.setResponseBody (this.responseBody);
- Calendar endTime = Calendar.getInstance ();
- Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
}
aq.setProgress (this.progress);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
index e22d182086..162e4f799a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
@@ -25,7 +25,6 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -86,8 +85,7 @@ public class VnfMsoInfraRequest {
VnfMsoInfraRequest (String requestId) {
this.requestId = requestId;
- Calendar startTimeCalendar = Calendar.getInstance ();
- this.startTime = startTimeCalendar.getTimeInMillis ();
+ this.startTime = System.currentTimeMillis();
MsoLogger.setLogContext (requestId, null);
}
@@ -285,7 +283,7 @@ public class VnfMsoInfraRequest {
aq.setRequestId (requestId);
aq.setClientRequestId(rinfo.getRequestId());
- Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
if (rinfo != null) {
if (rinfo.getAction () != null) {
aq.setAction (rinfo.getAction ().value ());
@@ -372,8 +370,7 @@ public class VnfMsoInfraRequest {
aq.setStatusMessage (this.errorMessage);
aq.setResponseBody (this.responseBody);
- Calendar endTime = Calendar.getInstance ();
- Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
index 42ef60bfaf..eb7d1874cd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
@@ -24,7 +24,6 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.Date;
import javax.ws.rs.core.Response;
@@ -83,8 +82,7 @@ public class VolumeMsoInfraRequest {
VolumeMsoInfraRequest (String requestId) {
this.requestId = requestId;
- Calendar startTimeCalendar = Calendar.getInstance ();
- this.startTime = startTimeCalendar.getTimeInMillis ();
+ this.startTime = System.currentTimeMillis();
MsoLogger.setLogContext (requestId, null);
}
@@ -287,7 +285,7 @@ public class VolumeMsoInfraRequest {
InfraActiveRequests aq = new InfraActiveRequests ();
aq.setRequestId (requestId);
- Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
if (rinfo != null) {
if (rinfo.getAction () != null) {
aq.setAction (rinfo.getAction ().value ());
@@ -350,8 +348,7 @@ public class VolumeMsoInfraRequest {
aq.setStatusMessage (this.errorMessage);
aq.setResponseBody (this.responseBody);
- Calendar endTime = Calendar.getInstance ();
- Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
}
aq.setProgress (this.progress);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 9abd871b5f..fda4461840 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -22,7 +22,6 @@ package org.openecomp.mso.requestsdb;
import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -98,8 +97,7 @@ public class RequestsDatabase {
query.setParameter ("requestStatus", requestStatus);
query.setParameter (REQUEST_ID, requestId);
query.setParameter ("lastModifiedBy", lastModifiedBy);
- Calendar modifyTime = Calendar.getInstance ();
- Timestamp modifyTimeStamp = new Timestamp (modifyTime.getTimeInMillis ());
+ Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
query.setParameter ("modifyTime", modifyTimeStamp);
result = query.executeUpdate ();
session.getTransaction ().commit ();
@@ -125,8 +123,7 @@ public class RequestsDatabase {
query.setParameter (REQUEST_ID, requestId);
query.setParameter ("progress", progress);
query.setParameter ("lastModifiedBy", lastModifiedBy);
- Calendar modifyTime = Calendar.getInstance ();
- Timestamp modifyTimeStamp = new Timestamp (modifyTime.getTimeInMillis ());
+ Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
query.setParameter ("modifyTime", modifyTimeStamp);
result = query.executeUpdate ();
session.getTransaction ().commit ();
@@ -150,8 +147,7 @@ public class RequestsDatabase {
Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, statusMessage = :statusMessage, progress = :progress, endTime = :endTime, responseBody = :responseBody, lastModifiedBy = :lastModifiedBy where id.requestId = :requestId ");
query.setParameter ("requestStatus", requestStatus);
query.setParameter ("requestId", requestId);
- Calendar endTime = Calendar.getInstance ();
- Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
query.setParameter ("endTime", endTimeStamp);
query.setParameter ("statusMessage", statusMessage);
query.setParameter ("progress", progress);