FileUtil.replaceFile(new File(tmpJarPath), new File(jarPath)); } catch (IOException e) { terminate(1, "I/O error renaming jar temporary file to path: " +
/** * Move the src file to the target using * {@link FileUtil#replaceFile(File, File)}. * * @param volume target volume. null if unavailable. * @param src source path. * @param target target path. * @throws IOException */ public void replaceFile( @Nullable FsVolumeSpi volume, File src, File target) throws IOException { final long begin = profilingEventHook.beforeMetadataOp(volume, MOVE); try { faultInjectorEventHook.beforeMetadataOp(volume, MOVE); FileUtil.replaceFile(src, target); profilingEventHook.afterMetadataOp(volume, MOVE, begin); } catch(Exception e) { onFailure(volume, begin); throw e; } }
LOG.info("Rolling forward previously half-completed synchronization: " + tmp + " -> " + dst + " ; journal id: " + journalId); FileUtil.replaceFile(tmp, dst);
FileUtil.replaceFile(syncedFile, storage.getInProgressEditLog(segmentTxId));
/** * Copy specified file into a temporary file. Then rename the * temporary file to the original name. This will cause any * hardlinks to the original file to be removed. The temporary * files are created in the detachDir. The temporary files will * be recovered (especially on Windows) on datanode restart. */ private void detachFile(int namespaceId, File file, Block b) throws IOException { File tmpFile = volume.createDetachFile(namespaceId, b, file.getName()); try { IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16*1024, true); if (file.length() != tmpFile.length()) { throw new IOException("Copy of file " + file + " size " + file.length()+ " into file " + tmpFile + " resulted in a size of " + tmpFile.length()); } FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete(); if (!done) { DataNode.LOG.info("detachFile failed to delete temporary file " + tmpFile); } throw e; } }
/** * Copy specified file into a temporary file. Then rename the * temporary file to the original name. This will cause any * hardlinks to the original file to be removed. The temporary * files are created in the detachDir. The temporary files will * be recovered (especially on Windows) on datanode restart. */ private void detachFile(File file, Block b) throws IOException { File tmpFile = volume.createDetachFile(b, file.getName()); try { IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16*1024, true); if (file.length() != tmpFile.length()) { throw new IOException("Copy of file " + file + " size " + file.length()+ " into file " + tmpFile + " resulted in a size of " + tmpFile.length()); } FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete(); if (!done) { DataNode.LOG.info("detachFile failed to delete temporary file " + tmpFile); } throw e; } }
" resulted in a size of " + tmpFile.length()); FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete();
" resulted in a size of " + tmpFile.length()); FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete();
FileUtil.replaceFile(new File(tmpJarPath), new File(jarPath)); } catch (IOException e) { terminate(1, "I/O error renaming jar temporary file to path: " +
FileUtil.replaceFile(new File(tmpJarPath), new File(jarPath)); } catch (IOException e) { terminate(1, "I/O error renaming jar temporary file to path: " +
FileUtil.replaceFile(new File(tmpJarPath), new File(jarPath)); } catch (IOException e) { terminate(1, "I/O error renaming jar temporary file to path: " +
FileUtil.replaceFile(new File(tmpJarPath), new File(jarPath)); } catch (IOException e) { terminate(1, "I/O error renaming jar temporary file to path: " +
FileUtil.replaceFile(new File(confDir, policyFileCopy), new File(confDir, HADOOP_POLICY_FILE));
LOG.info("Rolling forward previously half-completed synchronization: " + tmp + " -> " + dst); FileUtil.replaceFile(tmp, dst);
LOG.info("Rolling forward previously half-completed synchronization: " + tmp + " -> " + dst); FileUtil.replaceFile(tmp, dst);
final File targetFile = new File(tmp, "target"); assertTrue(!targetFile.exists()); FileUtil.replaceFile(srcFile, targetFile); assertTrue(!srcFile.exists()); assertTrue(targetFile.exists()); FileUtil.replaceFile(srcFile, targetFile); assertTrue(!srcFile.exists()); assertTrue(targetFile.exists()); assertTrue(targetFile.exists() && targetFile.isDirectory()); try { FileUtil.replaceFile(srcFile, targetFile); assertTrue(false); } catch (IOException ioe) {
final File targetFile = new File(tmp, "target"); assertTrue(!targetFile.exists()); FileUtil.replaceFile(srcFile, targetFile); assertTrue(!srcFile.exists()); assertTrue(targetFile.exists()); FileUtil.replaceFile(srcFile, targetFile); assertTrue(!srcFile.exists()); assertTrue(targetFile.exists()); assertTrue(targetFile.exists() && targetFile.isDirectory()); try { FileUtil.replaceFile(srcFile, targetFile); assertTrue(false); } catch (IOException ioe) {
FileUtil.replaceFile(syncedFile, storage.getInProgressEditLog(segmentTxId));
FileUtil.replaceFile(syncedFile, storage.getInProgressEditLog(segmentTxId));