HDFS-5860. Refactor INodeDirectory getDirectoryXFeature methods to use common getFeature helper method. Contributed by Jing Zhao.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-4685@1563374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-02-01 05:55:20 +00:00
parent 9e8cabf8ce
commit 3fd9f29d56
2 changed files with 5 additions and 12 deletions

View File

@ -56,6 +56,9 @@ HDFS-4685 (Unreleased)
HDFS-5858. Refactor common ACL test cases to be run through multiple
FileSystem implementations. (cnauroth)
HDFS-5860. Refactor INodeDirectory getDirectoryXFeature methods to use
common getFeature helper method. (Jing Zhao via cnauroth)
OPTIMIZATIONS
BUG FIXES

View File

@ -146,12 +146,7 @@ public void addSpaceConsumed(long nsDelta, long dsDelta, boolean verify)
* otherwise, return null.
*/
public final DirectoryWithQuotaFeature getDirectoryWithQuotaFeature() {
for (Feature f : features) {
if (f instanceof DirectoryWithQuotaFeature) {
return (DirectoryWithQuotaFeature)f;
}
}
return null;
return getFeature(DirectoryWithQuotaFeature.class);
}
/** Is this directory with quota? */
@ -186,12 +181,7 @@ protected DirectoryWithSnapshotFeature addSnapshotFeature(
* otherwise, return null.
*/
public final DirectoryWithSnapshotFeature getDirectoryWithSnapshotFeature() {
for (Feature f : features) {
if (f instanceof DirectoryWithSnapshotFeature) {
return (DirectoryWithSnapshotFeature) f;
}
}
return null;
return getFeature(DirectoryWithSnapshotFeature.class);
}
/** Is this file has the snapshot feature? */