public void remove ( Node node ) { if ( node == null ) return ; if ( node instanceof InnerNode ) { throw new IllegalArgumentException ( "Not allow to remove an inner node: " + NodeBase . getPath ( node ) ) ; } LOG . info ( "Removing a node: " + NodeBase . getPath ( node ) ) ; netlock . writeLock ( ) . lock ( ) ; try { String currentRackName = node . getNetworkLocation ( ) ; if ( clusterMap . remove ( node ) ) { InnerNode rack = ( InnerNode ) getNode ( node . getNetworkLocation ( ) ) ; if ( rack == null ) { if ( ! racks . remove ( currentRackName ) ) { LOG . error ( "Discrepancy between network topology and list of racks. " + "Removed rack " + currentRackName + " was not in the rack list." ) ; } } } LOG . debug ( "NetworkTopology became:\n" + this . toString ( ) ) ; } finally { netlock . writeLock ( ) . unlock ( ) ; } }
Remove a node Update node counter & rack counter if neccessary