本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.delete方法的典型用法代码示例。如果您正苦于以下问题:Java U.delete方法的具体用法?Java U.delete怎么用?Java U.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.delete方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutdown
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Shuts down test Kafka broker.
*/
public void shutdown() {
if (zkUtils != null)
zkUtils.close();
if (kafkaSrv != null)
kafkaSrv.shutdown();
if (zkServer != null) {
try {
zkServer.stop();
}
catch (IOException ignored) {
// No-op.
}
}
List<String> logDirs = scala.collection.JavaConversions.seqAsJavaList(kafkaCfg.logDirs());
for (String logDir : logDirs)
U.delete(new File(logDir));
}
示例2: cleanupTaskEnvironment
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void cleanupTaskEnvironment(HadoopTaskInfo info) throws IgniteCheckedException {
HadoopTaskContext ctx = ctxs.remove(new T2<>(info.type(), info.taskNumber())).get();
taskCtxClsPool.add(ctx.getClass());
File locDir = taskLocalDir(igniteWorkDirectory(), locNodeId, info);
if (locDir.exists())
U.delete(locDir);
}
示例3: delete
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public boolean delete(Path f, boolean recursive) throws IOException {
File file = convert(f);
if (file.isDirectory() && !recursive)
throw new IOException("Failed to remove directory in non recursive mode: " + f.toUri());
return U.delete(file);
}
示例4: readClosureFromFileAndDelete
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Reads closure from given file name and delete the file after.
*
* @param fileName Closure file name.
* @param <T> Type of closure argument.
* @return IgniteInClosure for post-configuration.
* @throws IOException In case of an error.
* @see #storeToFile(IgniteInClosure, String)
*/
@SuppressWarnings("unchecked")
public static <T> IgniteInClosure<T> readClosureFromFileAndDelete(String fileName) throws IOException {
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) {
return (IgniteInClosure<T>)new XStream().fromXML(reader);
}
finally {
U.delete(new File(fileName));
}
}
示例5: resolveWorkDirectory
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Resolves work directory.
*
* @param workDir Work directory.
* @param path Path to resolve.
* @param delIfExist Flag indicating whether to delete the specify directory or not.
* @return Resolved work directory.
* @throws IgniteCheckedException If failed.
*/
public static File resolveWorkDirectory(String workDir, String path, boolean delIfExist)
throws IgniteCheckedException {
File dir = new File(path);
if (!dir.isAbsolute()) {
if (F.isEmpty(workDir))
throw new IgniteCheckedException("Failed to resolve path (work directory has not been set): " + path);
dir = new File(workDir, dir.getPath());
}
if (delIfExist && dir.exists()) {
if (!U.delete(dir))
throw new IgniteCheckedException("Failed to delete directory: " + dir);
}
if (!mkdirs(dir))
throw new IgniteCheckedException("Directory does not exist and cannot be created: " + dir);
if (!dir.canRead())
throw new IgniteCheckedException("Cannot read from directory: " + dir);
if (!dir.canWrite())
throw new IgniteCheckedException("Cannot write to directory: " + dir);
return dir;
}
示例6: beforeTestsStarted
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
stopAllGrids();
deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_STORE_DIR, false));
U.delete(new File(U.getIgniteHome(), DFLT_STORE_DIR));
}
示例7: afterTest
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
G.stopAll(true);
deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_STORE_DIR, false));
U.delete(new File(U.getIgniteHome(), DFLT_STORE_DIR));
}
示例8: afterTestsStopped
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
super.afterTestsStopped();
U.delete(testWorkDir);
}
示例9: checkAndInitCacheWorkDir
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param cacheWorkDir Cache work directory.
*/
private boolean checkAndInitCacheWorkDir(File cacheWorkDir) throws IgniteCheckedException {
boolean dirExisted = false;
if (!cacheWorkDir.exists()) {
boolean res = cacheWorkDir.mkdirs();
if (!res)
throw new IgniteCheckedException("Failed to initialize cache working directory " +
"(failed to create, make sure the work folder has correct permissions): " +
cacheWorkDir.getAbsolutePath());
}
else {
if (cacheWorkDir.isFile())
throw new IgniteCheckedException("Failed to initialize cache working directory " +
"(a file with the same name already exists): " + cacheWorkDir.getAbsolutePath());
File lockF = new File(cacheWorkDir, IgniteCacheSnapshotManager.SNAPSHOT_RESTORE_STARTED_LOCK_FILENAME);
Path cacheWorkDirPath = cacheWorkDir.toPath();
Path tmp = cacheWorkDirPath.getParent().resolve(cacheWorkDir.getName() + ".tmp");
if (Files.exists(tmp) && Files.isDirectory(tmp) &&
Files.exists(tmp.resolve(IgniteCacheSnapshotManager.TEMP_FILES_COMPLETENESS_MARKER))) {
U.warn(log, "Ignite node crashed during the snapshot restore process " +
"(there is a snapshot restore lock file left for cache). But old version of cache was saved. " +
"Trying to restore it. Cache - [" + cacheWorkDir.getAbsolutePath() + ']');
U.delete(cacheWorkDir);
try {
Files.move(tmp, cacheWorkDirPath, StandardCopyOption.ATOMIC_MOVE);
cacheWorkDirPath.resolve(IgniteCacheSnapshotManager.TEMP_FILES_COMPLETENESS_MARKER).toFile().delete();
}
catch (IOException e) {
throw new IgniteCheckedException(e);
}
}
else if (lockF.exists()) {
U.warn(log, "Ignite node crashed during the snapshot restore process " +
"(there is a snapshot restore lock file left for cache). Will remove both the lock file and " +
"incomplete cache directory [cacheDir=" + cacheWorkDir.getAbsolutePath() + ']');
boolean deleted = U.delete(cacheWorkDir);
if (!deleted)
throw new IgniteCheckedException("Failed to remove obsolete cache working directory " +
"(remove the directory manually and make sure the work folder has correct permissions): " +
cacheWorkDir.getAbsolutePath());
cacheWorkDir.mkdirs();
}
else
dirExisted = true;
if (!cacheWorkDir.exists())
throw new IgniteCheckedException("Failed to initialize cache working directory " +
"(failed to create, make sure the work folder has correct permissions): " +
cacheWorkDir.getAbsolutePath());
if (Files.exists(tmp))
U.delete(tmp);
}
return dirExisted;
}
示例10: deleteDefaultDBWorkDirectory
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Deletes the default DB working directory with all sub-directories and files.
*
* @return {@code true} if and only if the file or directory is successfully deleted, otherwise {@code false}.
* @throws IgniteCheckedException In case of an error.
* @see #getDefaultDbWorkPath()
* @see #deleteDefaultDBWorkDirectory()
*/
protected boolean deleteDefaultDBWorkDirectory() throws IgniteCheckedException {
Path dir = getDefaultDbWorkPath();
return Files.notExists(dir) || U.delete(dir.toFile());
}
示例11: afterTestsStopped
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Cleans temporary deployment directory.
*
* @throws Exception if cleanup failed.
*/
@Override protected void afterTestsStopped() throws Exception {
U.delete(getDeployDir());
}