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>
This commit is contained in:
parent
a46ba03d15
commit
971a4c8e83
|
@ -295,22 +295,12 @@ public class NetworkTopology {
|
||||||
|
|
||||||
/** @return the total number of racks */
|
/** @return the total number of racks */
|
||||||
public int getNumOfRacks() {
|
public int getNumOfRacks() {
|
||||||
netlock.readLock().lock();
|
|
||||||
try {
|
|
||||||
return numOfRacks;
|
return numOfRacks;
|
||||||
} finally {
|
|
||||||
netlock.readLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the total number of leaf nodes */
|
/** @return the total number of leaf nodes */
|
||||||
public int getNumOfLeaves() {
|
public int getNumOfLeaves() {
|
||||||
netlock.readLock().lock();
|
|
||||||
try {
|
|
||||||
return clusterMap.getNumOfLeaves();
|
return clusterMap.getNumOfLeaves();
|
||||||
} finally {
|
|
||||||
netlock.readLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the distance between two nodes
|
/** Return the distance between two nodes
|
||||||
|
|
Loading…
Reference in New Issue