public boolean isFairGame ( String workUnit ) { ObjectNode workUnitData = cluster . allWorkUnits . get ( workUnit ) ; if ( workUnitData == null || workUnitData . size ( ) == 0 ) { return true ; } try { JsonNode pegged = workUnitData . get ( cluster . name ) ; if ( pegged == null ) { return true ; } LOG . debug ( "Pegged status for {}: {}." , workUnit , pegged ) ; return pegged . asText ( ) . equals ( cluster . myNodeID ) ; } catch ( Exception e ) { LOG . error ( String . format ( "Error parsing mapping for %s: %s" , workUnit , workUnitData ) , e ) ; return true ; } }
Determines whether or not a given work unit is designated claimable by this node . If the ZNode for this work unit is empty or contains JSON mapping this node to that work unit it s considered claimable .