diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 6c348091c9..0f3768cb26 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -430,6 +430,9 @@ Release 2.4.0 - UNRELEASED HADOOP-10173. Remove UGI from DIGEST-MD5 SASL server creation (daryn via kihwal) + HADOOP-10228. FsPermission#fromShort() should cache FsAction.values(). + (Haohui Mai via cnauroth) + BUG FIXES HADOOP-9964. Fix deadlocks in TestHttpServer by synchronize diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java index 9a5d916689..76950305ed 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java @@ -120,8 +120,7 @@ private void set(FsAction u, FsAction g, FsAction o, boolean sb) { } public void fromShort(short n) { - FsAction[] v = FsAction.values(); - + FsAction[] v = FSACTION_VALUES; set(v[(n >>> 6) & 7], v[(n >>> 3) & 7], v[n & 7], (((n >>> 9) & 1) == 1) ); } @@ -210,6 +209,8 @@ public FsPermission applyUMask(FsPermission umask) { public static final int DEFAULT_UMASK = CommonConfigurationKeys.FS_PERMISSIONS_UMASK_DEFAULT; + private static final FsAction[] FSACTION_VALUES = FsAction.values(); + /** * Get the user file creation mask (umask) *