synchronized boolean processHeartbeat ( TaskTrackerStatus trackerStatus , boolean initialContact ) { String trackerName = trackerStatus . getTrackerName ( ) ; synchronized ( taskTrackers ) { synchronized ( trackerExpiryQueue ) { boolean seenBefore = updateTaskTrackerStatus ( trackerName , trackerStatus ) ; TaskTracker taskTracker = getTaskTracker ( trackerName ) ; if ( initialContact ) { // If it's first contact, then clear out // any state hanging around if ( seenBefore ) { LOG . warn ( "initialContact but seenBefore from Tracker : " + trackerName ) ; lostTaskTracker ( taskTracker ) ; } } else { // If not first contact, there should be some record of the tracker if ( ! seenBefore ) { LOG . warn ( "Status from unknown Tracker : " + trackerName ) ; updateTaskTrackerStatus ( trackerName , null ) ; return false ; } } if ( initialContact ) { // if this is lost tracker that came back now, and if it blacklisted // increment the count of blacklisted trackers in the cluster if ( isBlacklisted ( trackerName ) ) { faultyTrackers . incrBlackListedTrackers ( 1 ) ; } addNewTracker ( taskTracker ) ; } } } updateTaskStatuses ( trackerStatus ) ; updateNodeHealthStatus ( trackerStatus ) ; return true ; }
Process incoming heartbeat messages from the task trackers .