Source:
<code>public DataSegment push(File inDir, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getHdfsStorageDir(segment); log.info( "Copying segment[%s] to HDFS at location[%s/%s]", segment.getIdentifier(), config.getStorageDirectory(), storageDir ); Path tmpFile = new Path(String.format( "%s/%s/index.zip", config.getStorageDirectory(), UUIDUtils.generateUuid() )); FileSystem fs = tmpFile.getFileSystem(hadoopConfig); fs.mkdirs(tmpFile.getParent()); log.info("Compressing files from[%s] to [%s]", inDir, tmpFile); final long size; final DataSegment dataSegment; try (FSDataOutputStream out = fs.create(tmpFile)) { size = CompressionUtils.zip(inDir, out); final Path outFile = new Path(String.format("%s/%s/index.zip", config.getStorageDirectory(), storageDir)); final Path outDir = outFile.getParent(); dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outFile)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(inDir)), tmpFile.getParent(), fs ); fs.mkdirs(outDir.getParent()); <START> if (!new HadoopFsWrapper(fs).rename(tmpFile.getParent(), outDir)) { <END> if (fs.exists(outDir)) { log.info( "Unable to rename temp directory[%s] to segment directory[%s]. It is already pushed by a replica task.", tmpFile.getParent(), outDir ); } else { throw new IOException(String.format( "Failed to rename temp directory[%s] and segment directory[%s] is not present.", tmpFile.getParent(), outDir )); } } } finally { try { if (fs.exists(tmpFile.getParent()) && !fs.delete(tmpFile.getParent(), true)) { log.error("Failed to delete temp directory[%s]", tmpFile.getParent()); } } catch(IOException ex) { log.error(ex, "Failed to delete temp directory[%s]", tmpFile.getParent()); } } return dataSegment; }</code><technical_language>Object, this basically a static method</technical_language>

Target:
public DataSegment push(File inDir, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getHdfsStorageDir(segment); log.info( "Copying segment[%s] to HDFS at location[%s/%s]", segment.getIdentifier(), config.getStorageDirectory(), storageDir ); Path tmpFile = new Path(String.format( "%s/%s/index.zip", config.getStorageDirectory(), UUIDUtils.generateUuid() )); FileSystem fs = tmpFile.getFileSystem(hadoopConfig); fs.mkdirs(tmpFile.getParent()); log.info("Compressing files from[%s] to [%s]", inDir, tmpFile); final long size; final DataSegment dataSegment; try (FSDataOutputStream out = fs.create(tmpFile)) { size = CompressionUtils.zip(inDir, out); final Path outFile = new Path(String.format("%s/%s/index.zip", config.getStorageDirectory(), storageDir)); final Path outDir = outFile.getParent(); dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outFile)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(inDir)), tmpFile.getParent(), fs ); fs.mkdirs(outDir.getParent()); if (!HadoopFsWrapper.rename(fs, tmpFile.getParent(), outDir)) { if (fs.exists(outDir)) { log.info( "Unable to rename temp directory[%s] to segment directory[%s]. It is already pushed by a replica task.", tmpFile.getParent(), outDir ); } else { throw new IOException(String.format( "Failed to rename temp directory[%s] and segment directory[%s] is not present.", tmpFile.getParent(), outDir )); } } } finally { try { if (fs.exists(tmpFile.getParent()) && !fs.delete(tmpFile.getParent(), true)) { log.error("Failed to delete temp directory[%s]", tmpFile.getParent()); } } catch(IOException ex) { log.error(ex, "Failed to delete temp directory[%s]", tmpFile.getParent()); } } return dataSegment; }