public boolean isOnSameRack ( Node node1 , Node node2 ) { if ( node1 == null || node2 == null ) { return false ; } netlock . readLock ( ) . lock ( ) ; try { return node1 . getParent ( ) == node2 . getParent ( ) ; } finally { netlock . readLock ( ) . unlock ( ) ; } }
Check if two nodes are on the same rack