public synchronized static String getUniqueFile ( TaskAttemptContext context , String name , String extension ) { TaskID taskId = context . getTaskAttemptID ( ) . getTaskID ( ) ; int partition = taskId . getId ( ) ; StringBuilder result = new StringBuilder ( ) ; result . append ( name ) ; result . append ( ' ' ) ; result . append ( taskId . isMap ( ) ? ' ' : ' ' ) ; result . append ( ' ' ) ; result . append ( NUMBER_FORMAT . format ( partition ) ) ; result . append ( extension ) ; return result . toString ( ) ; }
Generate a unique filename based on the task id name and extension