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


Java FileUtils.delete方法代码示例

本文整理汇总了Java中org.apache.cassandra.io.util.FileUtils.delete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.delete方法的具体用法?Java FileUtils.delete怎么用?Java FileUtils.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.io.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.delete方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
 * We use a ReferenceQueue to manage deleting files that have been compacted
 * and for which no more SSTable references exist.  But this is not guaranteed
 * to run for each such file because of the semantics of the JVM gc.  So,
 * we write a marker to `compactedFilename` when a file is compacted;
 * if such a marker exists on startup, the file should be removed.
 *
 * This method will also remove SSTables that are marked as temporary.
 *
 * @return true if the file was deleted
 */
public static boolean delete(Descriptor desc, Set<Component> components)
{
    // remove the DATA component first if it exists
    if (components.contains(Component.DATA))
        FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
    for (Component component : components)
    {
        if (component.equals(Component.DATA) || component.equals(Component.SUMMARY))
            continue;

        FileUtils.deleteWithConfirm(desc.filenameFor(component));
    }

    if (components.contains(Component.SUMMARY))
        FileUtils.delete(desc.filenameFor(Component.SUMMARY));

    logger.trace("Deleted {}", desc);
    return true;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:31,代码来源:SSTable.java

示例2: delete

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
 * We use a ReferenceQueue to manage deleting files that have been compacted
 * and for which no more SSTable references exist.  But this is not guaranteed
 * to run for each such file because of the semantics of the JVM gc.  So,
 * we write a marker to `compactedFilename` when a file is compacted;
 * if such a marker exists on startup, the file should be removed.
 *
 * This method will also remove SSTables that are marked as temporary.
 *
 * @return true if the file was deleted
 */
public static boolean delete(Descriptor desc, Set<Component> components)
{
    // remove the DATA component first if it exists
    if (components.contains(Component.DATA))
        FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
    for (Component component : components)
    {
        if (component.equals(Component.DATA) || component.equals(Component.SUMMARY))
            continue;

        FileUtils.deleteWithConfirm(desc.filenameFor(component));
    }
    FileUtils.delete(desc.filenameFor(Component.SUMMARY));

    logger.debug("Deleted {}", desc);
    return true;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:29,代码来源:SSTable.java

示例3: delete

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
 * We use a ReferenceQueue to manage deleting files that have been compacted
 * and for which no more SSTable references exist.  But this is not guaranteed
 * to run for each such file because of the semantics of the JVM gc.  So,
 * we write a marker to `compactedFilename` when a file is compacted;
 * if such a marker exists on startup, the file should be removed.
 *
 * This method will also remove SSTables that are marked as temporary.
 *
 * @return true if the file was deleted
 */
public static boolean delete(Descriptor desc, Set<Component> components)
{
    // remove the DATA component first if it exists
    if (components.contains(Component.DATA))
        FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
    for (Component component : components)
    {
        if (component.equals(Component.DATA) || component.equals(Component.COMPACTED_MARKER) || component.equals(Component.SUMMARY))
            continue;

        FileUtils.deleteWithConfirm(desc.filenameFor(component));
    }
    // remove the COMPACTED_MARKER component last if it exists
    // Note: newly created sstable should not have a marker, but we keep this for now to make sure
    // we don't leave older marker around
    FileUtils.delete(desc.filenameFor(Component.COMPACTED_MARKER));
    FileUtils.delete(desc.filenameFor(Component.SUMMARY));

    logger.debug("Deleted {}", desc);
    return true;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:33,代码来源:SSTable.java

示例4: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
        serialize(currentComponents, out, descriptor.version);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows)
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:MetadataSerializer.java

示例5: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    Descriptor tmpDescriptor = descriptor.asType(Descriptor.Type.TEMP);

    try (DataOutputStreamAndChannel out = new DataOutputStreamAndChannel(new FileOutputStream(tmpDescriptor.filenameFor(Component.STATS))))
    {
        serialize(currentComponents, out);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows())
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(tmpDescriptor.filenameFor(Component.STATS), descriptor.filenameFor(Component.STATS));

}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:MetadataSerializer.java

示例6: cleanupSavedCaches

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
protected static void cleanupSavedCaches()
{
    File cachesDir = new File(DatabaseDescriptor.getSavedCachesLocation());

    if (!cachesDir.exists() || !cachesDir.isDirectory())
        return;

    FileUtils.delete(cachesDir.listFiles());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:SchemaLoader.java

示例7: release

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public void release()
{
    int n = references.decrementAndGet();
    if (n == 0)
    {
        FileUtils.closeQuietly(index);
        sstable.releaseReference();
        if (obsolete.get() || sstable.isMarkedCompacted())
            FileUtils.delete(index.getIndexPath());
    }
}
 
开发者ID:xedin,项目名称:sasi,代码行数:12,代码来源:SSTableIndex.java

示例8: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
        serialize(currentComponents, out, descriptor.version);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows())
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:MetadataSerializer.java

示例9: cleanupSavedCaches

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static void cleanupSavedCaches()
{
    File cachesDir = new File(DatabaseDescriptor.getSavedCachesLocation());

    if (!cachesDir.exists() || !cachesDir.isDirectory())
        return;

    FileUtils.delete(cachesDir.listFiles());
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:CQLTester.java

示例10: cleanupSavedCaches

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private static void cleanupSavedCaches() {
  File cachesDir = new File(DatabaseDescriptor.getSavedCachesLocation());
  if (!cachesDir.exists() || !cachesDir.isDirectory()) return;

  FileUtils.delete(cachesDir.listFiles());
}
 
开发者ID:openzipkin,项目名称:brave-cassandra,代码行数:7,代码来源:CassandraRule.java

示例11: delete

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public void delete()
{
    FileUtils.delete(lockfile);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:StreamLockfile.java


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