@@ -39,15 +39,15 @@ public class HdfsJarUploadUtils {
3939 * given the {@link FileStatus} of a jarFile and the path of directory that contains jar.
4040 * Snapshot dirs should not be shared, as different jobs may be using different versions of it.
4141 * @param fs
42- * @param localJar
42+ * @param localJarPath
4343 * @param unsharedJarsDir
4444 * @param jarCacheDir
4545 * @return
4646 * @throws IOException
4747 */
48- public static Path calculateDestJarFile (FileSystem fs , FileStatus localJar , Path unsharedJarsDir , Path jarCacheDir ) throws IOException {
49- Path uploadDir = localJar . getPath (). getName () .contains ("SNAPSHOT" ) ? unsharedJarsDir : jarCacheDir ;
50- Path destJarFile = new Path (fs .makeQualified (uploadDir ), localJar . getPath (). getName () );
48+ public static Path calculateDestJarFilePath (FileSystem fs , String localJarPath , Path unsharedJarsDir , Path jarCacheDir ) throws IOException {
49+ Path uploadDir = localJarPath .contains ("SNAPSHOT" ) ? unsharedJarsDir : jarCacheDir ;
50+ Path destJarFile = new Path (fs .makeQualified (uploadDir ), localJarPath );
5151 return destJarFile ;
5252 }
5353 /**
@@ -67,10 +67,9 @@ public static boolean uploadJarToHdfs(FileSystem fs, FileStatus localJar, int ma
6767 Thread .sleep (WAITING_TIME_ON_INCOMPLETE_UPLOAD_MILLIS );
6868 throw new IOException ("Waiting for file to complete on uploading ... " );
6969 }
70- // Set the first parameter as false for not deleting sourceFile
71- // Set the second parameter as false for not overwriting existing file on the target, by default it is true.
72- // If the file is preExisted but overwrite flag set to false, then an IOException if thrown.
73- fs .copyFromLocalFile (false , false , localJar .getPath (), destJarFile );
70+ boolean deleteSourceFile = false ;
71+ boolean overwriteAnyExistingDestFile = false ; // IOException will be thrown if does already exist
72+ fs .copyFromLocalFile (deleteSourceFile , overwriteAnyExistingDestFile , localJar .getPath (), destJarFile );
7473 } catch (IOException | InterruptedException e ) {
7574 log .warn ("Path:" + destJarFile + " is not copied successfully. Will require retry." );
7675 retryCount += 1 ;
0 commit comments