当前位置: 首页>>代码示例>>Java>>正文


Java U.delete方法代码示例

本文整理汇总了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));
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:TestKafkaBroker.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:HadoopV2Job.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:HadoopRawLocalFileSystem.java

示例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));
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:IgniteCompatibilityNodeRunner.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:37,代码来源:IgniteUtils.java

示例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));
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:IgnitePdsRemoveDuringRebalancingTest.java

示例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));
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:IgnitePdsRemoveDuringRebalancingTest.java

示例8: afterTestsStopped

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
    super.afterTestsStopped();

    U.delete(testWorkDir);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:HadoopCommandLineTest.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:72,代码来源:FilePageStoreManager.java

示例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());
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:IgnitePersistenceCompatibilityAbstractTest.java

示例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());
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridUriDeploymentMd5CheckSelfTest.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。