You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by rk...@apache.org on 2016/09/13 20:13:49 UTC

oozie git commit: OOZIE-2635 TimeZone.getTimeZone has performance issue. (satishsaley via rkanter)

Repository: oozie
Updated Branches:
  refs/heads/master 7e12f0abc -> 48515adef


OOZIE-2635 TimeZone.getTimeZone has performance issue. (satishsaley via rkanter)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/48515ade
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/48515ade
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/48515ade

Branch: refs/heads/master
Commit: 48515adef57e3bd0595bb716a9ce3cd8e5f95e50
Parents: 7e12f0a
Author: Robert Kanter <rk...@cloudera.com>
Authored: Tue Sep 13 13:10:57 2016 -0700
Committer: Robert Kanter <rk...@cloudera.com>
Committed: Tue Sep 13 13:12:32 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/oozie/client/rest/JsonUtils.java   | 9 +++++++--
 release-log.txt                                             | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/48515ade/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java b/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java
index 74e485c..aa3d983 100644
--- a/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java
+++ b/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java
@@ -35,6 +35,11 @@ import org.json.simple.JSONObject;
  */
 public class JsonUtils {
 
+    /*
+     * GMT is the most commonly used timezone; we can save on parsing and
+     * creating a TimeZone by creating a GMT TimeZone once
+     */
+    private static TimeZone GMT_TZ = TimeZone.getTimeZone("GMT");
     /**
      * Format a Date in RFC822 with the given time zone.
      *
@@ -44,7 +49,7 @@ public class JsonUtils {
      */
     public static String formatDateRfc822(Date date, String timeZoneId) {
         if (date != null) {
-            TimeZone tZone = TimeZone.getTimeZone(timeZoneId);
+            TimeZone tZone = "GMT".equals(timeZoneId) ? GMT_TZ : TimeZone.getTimeZone(timeZoneId);
             SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
             dateFormater.setTimeZone(tZone);
             return dateFormater.format(date);
@@ -72,7 +77,7 @@ public class JsonUtils {
         if (str != null) {
             try {
                 SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
-                dateFormater.setTimeZone(TimeZone.getTimeZone("GMT"));
+                dateFormater.setTimeZone(GMT_TZ);
                 return dateFormater.parse(str);
             }
             catch (ParseException ex) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/48515ade/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index c03a5c7..bb8ca5a 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2635 TimeZone.getTimeZone has performance issue. (satishsaley via rkanter)
 OOZIE-2583 oozie throws EL Exception when reference variable name containing dot (abhishekbafna via jaydeepvishwakarma)
 OOZIE-2653 Close active connection to hcat server in fs action (satishsaley via puru)
 OOZIE-2617 Read properties files in action configurations (wutaklon via jaydeepvishwakarma)