@ Nullable private MasterWorkerInfo registerWorkerInternal ( long workerId ) { for ( IndexedSet < MasterWorkerInfo > workers : Arrays . asList ( mTempWorkers , mLostWorkers ) ) { MasterWorkerInfo worker = workers . getFirstByField ( ID_INDEX , workerId ) ; if ( worker == null ) { continue ; } synchronized ( worker ) { worker . updateLastUpdatedTimeMs ( ) ; mWorkers . add ( worker ) ; workers . remove ( worker ) ; if ( workers == mLostWorkers ) { for ( Consumer < Address > function : mLostWorkerFoundListeners ) { function . accept ( new Address ( worker . getWorkerAddress ( ) . getHost ( ) , worker . getWorkerAddress ( ) . getRpcPort ( ) ) ) ; } LOG . warn ( "A lost worker {} has requested its old id {}." , worker . getWorkerAddress ( ) , worker . getId ( ) ) ; } } return worker ; } return null ; }
Re - register a lost worker or complete registration after getting a worker id .