public void adjustLocalityRequirement ( long now , long nodeWait , long rackWait ) { if ( ! localityWaitStarted ) { return ; } if ( localityRequired == LocalityLevel . ANY ) { return ; } if ( localityRequired == LocalityLevel . NODE ) { if ( now - localityWaitStartTime > nodeWait ) { setLocalityLevel ( LocalityLevel . RACK ) ; } } if ( localityRequired == LocalityLevel . RACK ) { if ( now - localityWaitStartTime > rackWait ) { setLocalityLevel ( LocalityLevel . ANY ) ; } } }
Adjust the locality requirement based on the current locality and the locality wait times . If the current required locality is node and enough time has passed - update it to rack . If the current is rack and enough time has passed - update to any