HDFS-11287. Storage class member storageDirs should be private to avoid unprotected access by derived classes. (Manoj Govindassamy via lei)

(cherry picked from commit 63320d1daa)
This commit is contained in:
Lei Xu 2017-01-19 15:36:54 +08:00
parent 8d6fa4569b
commit 541efe18c7
3 changed files with 4 additions and 4 deletions

View File

@ -123,9 +123,9 @@ public abstract class Storage extends StorageInfo {
public boolean isOfType(StorageDirType type);
}
protected List<StorageDirectory> storageDirs =
private final List<StorageDirectory> storageDirs =
new CopyOnWriteArrayList<>();
private class DirIterator implements Iterator<StorageDirectory> {
final StorageDirType dirType;
final boolean includeShared;

View File

@ -296,7 +296,7 @@ public class BlockPoolSliceStorage extends Storage {
it.hasNext(); ) {
StorageDirectory sd = it.next();
if (sd.getRoot().getAbsoluteFile().equals(absPathToRemove)) {
this.storageDirs.remove(sd);
getStorageDirs().remove(sd);
break;
}
}

View File

@ -519,7 +519,7 @@ public class DataStorage extends Storage {
bpsStorage.remove(bpRoot.getAbsoluteFile());
}
this.storageDirs.remove(sd);
getStorageDirs().remove(sd);
try {
sd.unlock();
} catch (IOException e) {