hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1170451 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
Date Wed, 14 Sep 2011 06:51:22 GMT
Author: todd
Date: Wed Sep 14 06:51:21 2011
New Revision: 1170451

URL: http://svn.apache.org/viewvc?rev=1170451&view=rev
Log:
HADOOP-7629. Allow immutable FsPermission objects to be used as IPC parameters. Contributed
by Todd Lipcon.

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1170451&r1=1170450&r2=1170451&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Wed Sep 14 06:51:21
2011
@@ -583,6 +583,9 @@ Release 0.23.0 - Unreleased
 
     HADOOP-7626. Bugfix for a config generator (Eric Yang via ddas)
 
+    HADOOP-7629. Allow immutable FsPermission objects to be used as IPC
+    parameters. (todd)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java?rev=1170451&r1=1170450&r2=1170451&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
Wed Sep 14 06:51:21 2011
@@ -44,18 +44,12 @@ public class FsPermission implements Wri
   };
   static {                                      // register a ctor
     WritableFactories.setFactory(FsPermission.class, FACTORY);
+    WritableFactories.setFactory(ImmutableFsPermission.class, FACTORY);
   }
 
   /** Create an immutable {@link FsPermission} object. */
   public static FsPermission createImmutable(short permission) {
-    return new FsPermission(permission) {
-      public FsPermission applyUMask(FsPermission umask) {
-        throw new UnsupportedOperationException();
-      }
-      public void readFields(DataInput in) throws IOException {
-        throw new UnsupportedOperationException();
-      }
-    };
+    return new ImmutableFsPermission(permission);
   }
 
   //POSIX permission style
@@ -301,4 +295,16 @@ public class FsPermission implements Wri
 
     return new FsPermission((short)n);
   }
+  
+  private static class ImmutableFsPermission extends FsPermission {
+    public ImmutableFsPermission(short permission) {
+      super(permission);
+    }
+    public FsPermission applyUMask(FsPermission umask) {
+      throw new UnsupportedOperationException();
+    }
+    public void readFields(DataInput in) throws IOException {
+      throw new UnsupportedOperationException();
+    }    
+  }
 }



Mime
View raw message