HDFS-14523. Remove excess read lock for NetworkToplogy. Contributed by Wu Weiwei.
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org> Reviewed-by: Chen Liang <cliang@apache.org> (cherry picked from commit 971a4c8e8328a4bdea65de4a0e84c82b5b2de24b)
This commit is contained in:
parent
ab7ecd6a0f
commit
41c0757a1f
@ -295,22 +295,12 @@ public String getRack(String loc) {
|
||||
|
||||
/** @return the total number of racks */
|
||||
public int getNumOfRacks() {
|
||||
netlock.readLock().lock();
|
||||
try {
|
||||
return numOfRacks;
|
||||
} finally {
|
||||
netlock.readLock().unlock();
|
||||
}
|
||||
return numOfRacks;
|
||||
}
|
||||
|
||||
/** @return the total number of leaf nodes */
|
||||
public int getNumOfLeaves() {
|
||||
netlock.readLock().lock();
|
||||
try {
|
||||
return clusterMap.getNumOfLeaves();
|
||||
} finally {
|
||||
netlock.readLock().unlock();
|
||||
}
|
||||
return clusterMap.getNumOfLeaves();
|
||||
}
|
||||
|
||||
/** Return the distance between two nodes
|
||||
|
Loading…
x
Reference in New Issue
Block a user