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/branches/branch-0.23@1170450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc9369f691
commit
f3ed02a68a
|
@ -573,6 +573,9 @@ Release 0.23.0 - Unreleased
|
||||||
|
|
||||||
HADOOP-7626. Bugfix for a config generator (Eric Yang via ddas)
|
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
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -44,18 +44,12 @@ public class FsPermission implements Writable {
|
||||||
};
|
};
|
||||||
static { // register a ctor
|
static { // register a ctor
|
||||||
WritableFactories.setFactory(FsPermission.class, FACTORY);
|
WritableFactories.setFactory(FsPermission.class, FACTORY);
|
||||||
|
WritableFactories.setFactory(ImmutableFsPermission.class, FACTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create an immutable {@link FsPermission} object. */
|
/** Create an immutable {@link FsPermission} object. */
|
||||||
public static FsPermission createImmutable(short permission) {
|
public static FsPermission createImmutable(short permission) {
|
||||||
return new FsPermission(permission) {
|
return new ImmutableFsPermission(permission);
|
||||||
public FsPermission applyUMask(FsPermission umask) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
public void readFields(DataInput in) throws IOException {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//POSIX permission style
|
//POSIX permission style
|
||||||
|
@ -301,4 +295,16 @@ public class FsPermission implements Writable {
|
||||||
|
|
||||||
return new FsPermission((short)n);
|
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