本文整理了Java中org.apache.flink.util.FileUtils.deleteFileOrDirectory()
方法的一些代码示例,展示了FileUtils.deleteFileOrDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteFileOrDirectory()
方法的具体详情如下:
包路径:org.apache.flink.util.FileUtils
类名称:FileUtils
方法名:deleteFileOrDirectory
[英]Removes the given file or directory recursively.
If the file or directory does not exist, this does not throw an exception, but simply does nothing. It considers the fact that a file-to-be-deleted is not present a success.
This method is safe against other concurrent deletion attempts.
[中]递归删除给定的文件或目录。
如果文件或目录不存在,则不会引发异常,而只是什么也不做。它认为要删除的文件不成功。
此方法对于其他并发删除尝试是安全的。
代码示例来源:origin: apache/flink
@Override
public void close() throws IOException {
FileUtils.deleteFileOrDirectory(path.toFile());
}
}
代码示例来源:origin: apache/flink
private static void cleanDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
final File[] files = directory.listFiles();
if (files == null) {
// directory does not exist any more or no permissions
if (directory.exists()) {
throw new IOException("Failed to list contents of " + directory);
} else {
throw new FileNotFoundException(directory.toString());
}
}
// remove all files in the directory
for (File file : files) {
if (file != null) {
deleteFileOrDirectory(file);
}
}
}
else if (directory.exists()) {
throw new IOException(directory + " is not a directory but a regular file");
}
else {
// else does not exist at all
throw new FileNotFoundException(directory.toString());
}
}
代码示例来源:origin: apache/flink
} finally {
try {
FileUtils.deleteFileOrDirectory(taskManagerConfigFile);
} catch (IOException e) {
log.info("Could not delete temporary configuration file " +
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
/**
* Deletes the base dirs for this allocation id (recursively).
*/
private void cleanupAllocationBaseDirs(AllocationID allocationID) {
// clear the base dirs for this allocation id.
File[] allocationDirectories = allocationBaseDirectories(allocationID);
for (File directory : allocationDirectories) {
try {
FileUtils.deleteFileOrDirectory(directory);
} catch (IOException e) {
LOG.warn("Exception while deleting local state directory for allocation id {}.", allocationID, e);
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
/**
* Deletes the base dirs for this allocation id (recursively).
*/
private void cleanupAllocationBaseDirs(AllocationID allocationID) {
// clear the base dirs for this allocation id.
File[] allocationDirectories = allocationBaseDirectories(allocationID);
for (File directory : allocationDirectories) {
try {
FileUtils.deleteFileOrDirectory(directory);
} catch (IOException e) {
LOG.warn("Exception while deleting local state directory for allocation id {}.", allocationID, e);
}
}
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Deletes the base dirs for this allocation id (recursively).
*/
private void cleanupAllocationBaseDirs(AllocationID allocationID) {
// clear the base dirs for this allocation id.
File[] allocationDirectories = allocationBaseDirectories(allocationID);
for (File directory : allocationDirectories) {
try {
FileUtils.deleteFileOrDirectory(directory);
} catch (IOException e) {
LOG.warn("Exception while deleting local state directory for allocation id {}.", allocationID, e);
}
}
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
@Override
public void close() throws IOException {
cleanupFuture.cancel(false);
jobDetailsCache.invalidateAll();
// clean up the storage directory
FileUtils.deleteFileOrDirectory(storageDir);
// Remove shutdown hook to prevent resource leaks
ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);
}
代码示例来源:origin: com.alibaba.blink/flink-core
private static void cleanDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
final File[] files = directory.listFiles();
if (files == null) {
// directory does not exist any more or no permissions
if (directory.exists()) {
throw new IOException("Failed to list contents of " + directory);
} else {
throw new FileNotFoundException(directory.toString());
}
}
// remove all files in the directory
for (File file : files) {
if (file != null) {
deleteFileOrDirectory(file);
}
}
}
else if (directory.exists()) {
throw new IOException(directory + " is not a directory but a regular file");
}
else {
// else does not exist at all
throw new FileNotFoundException(directory.toString());
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
@Override
public void close() throws IOException {
cleanupFuture.cancel(false);
jobDetailsCache.invalidateAll();
// clean up the storage directory
FileUtils.deleteFileOrDirectory(storageDir);
// Remove shutdown hook to prevent resource leaks
ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);
}
代码示例来源:origin: org.apache.flink/flink-runtime
@Override
public void close() throws IOException {
cleanupFuture.cancel(false);
jobDetailsCache.invalidateAll();
// clean up the storage directory
FileUtils.deleteFileOrDirectory(storageDir);
// Remove shutdown hook to prevent resource leaks
ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);
}
代码示例来源:origin: org.apache.flink/flink-core
private static void cleanDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
final File[] files = directory.listFiles();
if (files == null) {
// directory does not exist any more or no permissions
if (directory.exists()) {
throw new IOException("Failed to list contents of " + directory);
} else {
throw new FileNotFoundException(directory.toString());
}
}
// remove all files in the directory
for (File file : files) {
if (file != null) {
deleteFileOrDirectory(file);
}
}
}
else if (directory.exists()) {
throw new IOException(directory + " is not a directory but a regular file");
}
else {
// else does not exist at all
throw new FileNotFoundException(directory.toString());
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
private void deleteExecutionGraphFile(JobID jobId) {
Preconditions.checkNotNull(jobId);
final File archivedExecutionGraphFile = getExecutionGraphFile(jobId);
try {
FileUtils.deleteFileOrDirectory(archivedExecutionGraphFile);
} catch (IOException e) {
LOG.debug("Could not delete file {}.", archivedExecutionGraphFile, e);
}
archivedExecutionGraphCache.invalidate(jobId);
jobDetailsCache.invalidate(jobId);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
private void deleteExecutionGraphFile(JobID jobId) {
Preconditions.checkNotNull(jobId);
final File archivedExecutionGraphFile = getExecutionGraphFile(jobId);
try {
FileUtils.deleteFileOrDirectory(archivedExecutionGraphFile);
} catch (IOException e) {
LOG.debug("Could not delete file {}.", archivedExecutionGraphFile, e);
}
archivedExecutionGraphCache.invalidate(jobId);
jobDetailsCache.invalidate(jobId);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
private void deleteExecutionGraphFile(JobID jobId) {
Preconditions.checkNotNull(jobId);
final File archivedExecutionGraphFile = getExecutionGraphFile(jobId);
try {
FileUtils.deleteFileOrDirectory(archivedExecutionGraphFile);
} catch (IOException e) {
LOG.debug("Could not delete file {}.", archivedExecutionGraphFile, e);
}
archivedExecutionGraphCache.invalidate(jobId);
jobDetailsCache.invalidate(jobId);
}
代码示例来源:origin: org.apache.flink/flink-yarn_2.11
} finally {
try {
FileUtils.deleteFileOrDirectory(taskManagerConfigFile);
} catch (IOException e) {
log.info("Could not delete temporary configuration file " +
代码示例来源:origin: org.apache.flink/flink-yarn
} finally {
try {
FileUtils.deleteFileOrDirectory(taskManagerConfigFile);
} catch (IOException e) {
log.info("Could not delete temporary configuration file " +
内容来源于网络,如有侵权,请联系作者删除!