本文整理了Java中org.apache.kafka.common.utils.Utils.delete()
方法的一些代码示例,展示了Utils.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.delete()
方法的具体详情如下:
包路径:org.apache.kafka.common.utils.Utils
类名称:Utils
方法名:delete
[英]Recursively delete the given file/directory and any subfiles (if any exist)
[中]递归删除给定的文件/目录和任何子文件(如果存在)
代码示例来源:origin: apache/kafka
@Override
public void run() {
try {
Utils.delete(file);
} catch (IOException e) {
log.error("Error deleting {}", file.getAbsolutePath(), e);
}
}
});
代码示例来源:origin: apache/kafka
@Test(timeout = 120000)
public void testRecursiveDelete() throws IOException {
Utils.delete(null); // delete of null does nothing.
// Test that deleting a temporary file works.
File tempFile = TestUtils.tempFile();
Utils.delete(tempFile);
assertFalse(Files.exists(tempFile.toPath()));
// Test recursive deletes
File tempDir = TestUtils.tempDirectory();
File tempDir2 = TestUtils.tempDirectory(tempDir.toPath(), "a");
TestUtils.tempDirectory(tempDir.toPath(), "b");
TestUtils.tempDirectory(tempDir2.toPath(), "c");
Utils.delete(tempDir);
assertFalse(Files.exists(tempDir.toPath()));
assertFalse(Files.exists(tempDir2.toPath()));
// Test that deleting a non-existent directory hierarchy works.
Utils.delete(tempDir);
assertFalse(Files.exists(tempDir.toPath()));
}
}
代码示例来源:origin: org.apache.kafka/kafka-streams
void destroy() throws IOException {
Utils.delete(dbDir);
}
代码示例来源:origin: spring-cloud/spring-cloud-cli
void shutdown() throws Exception {
zookeeper.shutdown();
factory.shutdown();
Utils.delete(logDir);
Utils.delete(snapshotDir);
}
}
代码示例来源:origin: devicehive/devicehive-java-server
public void shutdown() {
zooKeeperServer.shutdown();
nioServerCnxnFactory.shutdown();
Utils.delete(logDir);
Utils.delete(snapshotDir);
}
代码示例来源:origin: rayokota/kafka-graphs
/**
* Create a temporary relative directory in the specified parent directory with the given prefix.
*
* @param parent The parent folder path name, if null using the default temporary-file directory
* @param prefix The prefix of the temporary directory, if null using "kafka-" as default prefix
*/
public static File tempDirectory(final Path parent, String prefix) {
final File file;
prefix = prefix == null ? "kafka-" : prefix;
try {
file = parent == null
?
Files.createTempDirectory(prefix).toFile()
: Files.createTempDirectory(parent, prefix).toFile();
} catch (final IOException ex) {
throw new RuntimeException("Failed to create a temp dir", ex);
}
file.deleteOnExit();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
Utils.delete(file);
} catch (IOException e) {
log.error("Error deleting {}", file.getAbsolutePath(), e);
}
}));
return file;
}
代码示例来源:origin: org.apache.kafka/kafka-streams
public synchronized void clean() {
try {
cleanRemovedTasks(0, true);
} catch (final Exception e) {
// this is already logged within cleanRemovedTasks
throw new StreamsException(e);
}
try {
Utils.delete(globalStateDir().getAbsoluteFile());
} catch (final IOException e) {
log.error("{} Failed to delete global state directory due to an unexpected exception", logPrefix(), e);
throw new StreamsException(e);
}
}
代码示例来源:origin: org.apache.kafka/kafka-streams
Utils.delete(new File(baseDir + File.separator + "rocksdb" + File.separator + storeName));
} catch (final IOException fatalException) {
log.error("Failed to reinitialize store {}.", storeName, fatalException);
Utils.delete(new File(baseDir + File.separator + storeName));
} catch (final IOException fatalException) {
log.error("Failed to reinitialize store {}.", storeName, fatalException);
代码示例来源:origin: org.apache.kafka/kafka-streams
id);
Utils.delete(taskDir);
内容来源于网络,如有侵权,请联系作者删除!