@@ -167,16 +167,15 @@ public void startLocalizer(LocalizerStartContext ctx)
167167 String tokenFn = String .format (TOKEN_FILE_NAME_FMT , locId );
168168 Path tokenDst = new Path (appStorageDir , tokenFn );
169169 copyFile (nmPrivateContainerTokensPath , tokenDst , user );
170- LOG .info ("Copying from " + nmPrivateContainerTokensPath
171- + " to " + tokenDst );
170+ LOG .info ("Copying from {} to {}" , nmPrivateContainerTokensPath , tokenDst );
172171
173172
174173 FileContext localizerFc =
175174 FileContext .getFileContext (lfs .getDefaultFileSystem (), getConf ());
176175 localizerFc .setUMask (lfs .getUMask ());
177176 localizerFc .setWorkingDirectory (appStorageDir );
178- LOG .info ("Localizer CWD set to " + appStorageDir + " = "
179- + localizerFc .getWorkingDirectory ());
177+ LOG .info ("Localizer CWD set to {} = {}" , appStorageDir ,
178+ localizerFc .getWorkingDirectory ());
180179
181180 ContainerLocalizer localizer =
182181 createContainerLocalizer (user , appId , locId , tokenFn , localDirs ,
@@ -292,8 +291,8 @@ public int launchContainer(ContainerStartContext ctx)
292291 if (pidFile != null ) {
293292 sb .writeLocalWrapperScript (launchDst , pidFile );
294293 } else {
295- LOG .info ("Container " + containerIdStr
296- + " pid file not set. Returning terminated error" );
294+ LOG .info ("Container {} pid file not set. Returning terminated error" ,
295+ containerIdStr );
297296 return ExitCode .TERMINATED .getExitCode ();
298297 }
299298
@@ -312,23 +311,23 @@ public int launchContainer(ContainerStartContext ctx)
312311 if (isContainerActive (containerId )) {
313312 shExec .execute ();
314313 } else {
315- LOG .info ("Container " + containerIdStr +
316- " was marked as inactive. Returning terminated error" );
314+ LOG .info ("Container {} was marked as inactive. "
315+ + " Returning terminated error", containerIdStr );
317316 return ExitCode .TERMINATED .getExitCode ();
318317 }
319318 } catch (IOException e ) {
320319 if (null == shExec ) {
321320 return -1 ;
322321 }
323322 int exitCode = shExec .getExitCode ();
324- LOG .warn ("Exit code from container " + containerId + " is : " + exitCode );
323+ LOG .warn ("Exit code from container {} is : {}" , containerId , exitCode );
325324 // 143 (SIGTERM) and 137 (SIGKILL) exit codes means the container was
326325 // terminated/killed forcefully. In all other cases, log the
327326 // container-executor's output
328327 if (exitCode != ExitCode .FORCE_KILLED .getExitCode ()
329328 && exitCode != ExitCode .TERMINATED .getExitCode ()) {
330- LOG .warn ("Exception from container-launch with container ID: "
331- + containerId + " and exit code: " + exitCode , e );
329+ LOG .warn ("Exception from container-launch with container ID: {} "
330+ + " and exit code: {}" , containerId , exitCode , e );
332331
333332 StringBuilder builder = new StringBuilder ();
334333 builder .append ("Exception from container-launch.\n " )
@@ -386,13 +385,13 @@ protected CommandExecutor buildCommandExecutor(String wrapperScriptPath,
386385 String [] command = getRunCommand (wrapperScriptPath ,
387386 containerIdStr , user , pidFile , this .getConf (), resource );
388387
389- LOG .info ("launchContainer: " + Arrays .toString (command ));
390- return new ShellCommandExecutor (
391- command ,
392- workDir ,
393- environment ,
394- 0L ,
395- false );
388+ LOG .info ("launchContainer: {}" , Arrays .toString (command ));
389+ return new ShellCommandExecutor (
390+ command ,
391+ workDir ,
392+ environment ,
393+ 0L ,
394+ false );
396395 }
397396
398397 /**
@@ -648,19 +647,19 @@ public void deleteAsUser(DeletionAsUserContext ctx)
648647 List <Path > baseDirs = ctx .getBasedirs ();
649648
650649 if (baseDirs == null || baseDirs .size () == 0 ) {
651- LOG .info ("Deleting absolute path : " + subDir );
650+ LOG .info ("Deleting absolute path : {}" , subDir );
652651 if (!lfs .delete (subDir , true )) {
653652 //Maybe retry
654- LOG .warn ("delete returned false for path: [" + subDir + "]" );
653+ LOG .warn ("delete returned false for path: [{}]" , subDir );
655654 }
656655 return ;
657656 }
658657 for (Path baseDir : baseDirs ) {
659658 Path del = subDir == null ? baseDir : new Path (baseDir , subDir );
660- LOG .info ("Deleting path : " + del );
659+ LOG .info ("Deleting path : {}" , del );
661660 try {
662661 if (!lfs .delete (del , true )) {
663- LOG .warn ("delete returned false for path: [" + del + "]" );
662+ LOG .warn ("delete returned false for path: [{}]" , del );
664663 }
665664 } catch (FileNotFoundException e ) {
666665 continue ;
@@ -743,7 +742,7 @@ protected Path getWorkingDir(List<String> localDirs, String user,
743742 try {
744743 space = getDiskFreeSpace (curBase );
745744 } catch (IOException e ) {
746- LOG .warn ("Unable to get Free Space for " + curBase . toString () , e );
745+ LOG .warn ("Unable to get Free Space for {}" , curBase , e );
747746 }
748747 availableOnDisk [i ++] = space ;
749748 totalAvailable += space ;
@@ -823,7 +822,7 @@ void createUserLocalDirs(List<String> localDirs, String user)
823822 createDir (getUserCacheDir (new Path (localDir ), user ), userperms , true ,
824823 user );
825824 } catch (IOException e ) {
826- LOG .warn ("Unable to create the user directory : " + localDir , e );
825+ LOG .warn ("Unable to create the user directory : {}" , localDir , e );
827826 continue ;
828827 }
829828 userDirStatus = true ;
@@ -850,7 +849,7 @@ void createUserLocalDirs(List<String> localDirs, String user)
850849 */
851850 void createUserCacheDirs (List <String > localDirs , String user )
852851 throws IOException {
853- LOG .info ("Initializing user " + user );
852+ LOG .info ("Initializing user {}" , user );
854853
855854 boolean appcacheDirStatus = false ;
856855 boolean distributedCacheDirStatus = false ;
@@ -865,15 +864,15 @@ void createUserCacheDirs(List<String> localDirs, String user)
865864 createDir (appDir , appCachePerms , true , user );
866865 appcacheDirStatus = true ;
867866 } catch (IOException e ) {
868- LOG .warn ("Unable to create app cache directory : " + appDir , e );
867+ LOG .warn ("Unable to create app cache directory : {}" , appDir , e );
869868 }
870869 // create $local.dir/usercache/$user/filecache
871870 final Path distDir = getFileCacheDir (localDirPath , user );
872871 try {
873872 createDir (distDir , fileperms , true , user );
874873 distributedCacheDirStatus = true ;
875874 } catch (IOException e ) {
876- LOG .warn ("Unable to create file cache directory : " + distDir , e );
875+ LOG .warn ("Unable to create file cache directory : {}" , distDir , e );
877876 }
878877 }
879878 if (!appcacheDirStatus ) {
@@ -911,7 +910,8 @@ void createAppDirs(List<String> localDirs, String user, String appId)
911910 createDir (fullAppDir , appperms , true , user );
912911 initAppDirStatus = true ;
913912 } catch (IOException e ) {
914- LOG .warn ("Unable to create app directory " + fullAppDir .toString (), e );
913+ LOG .warn ("Unable to create app directory {}" ,
914+ fullAppDir , e );
915915 }
916916 }
917917 if (!initAppDirStatus ) {
@@ -942,7 +942,7 @@ void createAppLogDirs(String appId, List<String> logDirs, String user)
942942 try {
943943 createDir (appLogDir , appLogDirPerms , true , user );
944944 } catch (IOException e ) {
945- LOG .warn ("Unable to create the app-log directory : " + appLogDir , e );
945+ LOG .warn ("Unable to create the app-log directory : {}" , appLogDir , e );
946946 continue ;
947947 }
948948 appLogDirStatus = true ;
@@ -976,8 +976,8 @@ void createContainerLogDirs(String appId, String containerId,
976976 try {
977977 createDir (containerLogDir , containerLogDirPerms , true , user );
978978 } catch (IOException e ) {
979- LOG .warn ("Unable to create the container-log directory : "
980- + appLogDir , e );
979+ LOG .warn ("Unable to create the container-log directory : {}" ,
980+ appLogDir , e );
981981 continue ;
982982 }
983983 containerLogDirStatus = true ;
0 commit comments