diff options
author | 2017-04-10 12:11:55 -0700 | |
---|---|---|
committer | 2017-04-10 12:14:07 -0700 | |
commit | 19340cad94eeaa1b580f7c0c99531de499e8ca14 (patch) | |
tree | af4989c384f5d8c54d01b2fa160e2d53ac71a6f5 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java | |
parent | d60f3ad34b20c16d31da8f8a09ed2d9adb10f493 (diff) |
Remove unnecessary use of Calendar.getInstance()
Calendar.getInstance() is expensive and unnecessary
when we only need the system time. This change
replaces the uses of Calendar.getInstance() with
System.currentTimeMillis().
Change-Id: I476f8850f5eb88d20cf7249cca5bb2e9b671b45a
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java | 12 |
1 files changed, 4 insertions, 8 deletions
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); } |