public synchronized void notifyTaskCompletion ( long jobId , int taskId , Object result ) { Pair < Long , Integer > id = new Pair <> ( jobId , taskId ) ; TaskInfo . Builder taskInfo = mUnfinishedTasks . get ( id ) ; taskInfo . setStatus ( Status . COMPLETED ) ; try { taskInfo . setResult ( ByteString . copyFrom ( SerializationUtils . serialize ( result ) ) ) ; } catch ( IOException e ) { // TODO(yupeng) better error handling LOG . warn ( "Failed to serialize {} : {}" , result , e . getMessage ( ) ) ; LOG . debug ( "Exception: " , e ) ; } finally { finishTask ( id ) ; LOG . info ( "Task {} for job {} completed." , taskId , jobId ) ; } }
Notifies the completion of the task .