HADOOP-7629. Allow immutable FsPermission objects to be used as IPC parameters. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1170451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a3e8f6836b
commit
29eadf1b8f
|
@ -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
|
||||
|
|
|
@ -44,18 +44,12 @@ public class FsPermission implements Writable {
|
|||
};
|
||||
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 Writable {
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue