org.apache.cassandra.io.util.FileUtils.deleteRecursive()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中org.apache.cassandra.io.util.FileUtils.deleteRecursive()方法的一些代码示例,展示了FileUtils.deleteRecursive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteRecursive()方法的具体详情如下:
包路径:org.apache.cassandra.io.util.FileUtils
类名称:FileUtils
方法名:deleteRecursive

FileUtils.deleteRecursive介绍

[英]Deletes all files and subdirectories under "dir".
[中]删除“dir”下的所有文件和子目录。

代码示例

代码示例来源:origin: hector-client/hector

private static void rmdir(String dir) throws IOException {
 File dirFile = new File(dir);
 if (dirFile.exists()) {
  FileUtils.deleteRecursive(new File(dir));
 }
}

代码示例来源:origin: hector-client/hector

public static void cleanup() throws IOException
{
  // clean up commitlog
  String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), };
  for (String dirName : directoryNames)
  {
    File dir = new File(dirName);
    if (!dir.exists())
      throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
    FileUtils.deleteRecursive(dir);
  }
  // clean up data directory which are stored as data directory/table/data files
  for (String dirName : DatabaseDescriptor.getAllDataFileLocations())
  {
    File dir = new File(dirName);
    if (!dir.exists())
      throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
    FileUtils.deleteRecursive(dir);
  }
}

代码示例来源:origin: hector-client/hector

public static void startCassandraInstance(String pathToDataDir) throws TTransportException, IOException,
InterruptedException, SecurityException, IllegalArgumentException, NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
 if (cassandraStarted) {
  return;
 }
 try {
  FileUtils.deleteRecursive(new File(pathToDataDir));
 }
 catch (AssertionError e) {
  // eat
 }
 embedded = new EmbeddedServerHelper();
 try {
  embedded.setup();
 } catch (ConfigurationException ce) {
  throw new RuntimeException(ce);
 }
 
 cassandraStarted = true;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
  public void onSuccess(StreamState finalState)
  {
    if (deleteSrc)
      FileUtils.deleteRecursive(outputDir);
  }
};

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

@Override
  public void onSuccess(StreamState finalState)
  {
    if (deleteSrc)
      FileUtils.deleteRecursive(outputDir);
  }
};

代码示例来源:origin: jsevellec/cassandra-unit

@Override
  public void onSuccess(StreamState finalState)
  {
    if (deleteSrc)
      FileUtils.deleteRecursive(outputDir);
  }
};

代码示例来源:origin: org.apache.cassandra/cassandra-all

public void run()
{
  try
  {
    FileUtils.deleteRecursive(path);
    logger.info("Successfully deleted snapshot {}.", path);
  }
  catch (FSWriteError e)
  {
    failedTasks.add(this);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

private static void rmdir(String dir) {
  File dirFile = new File(dir);
  if (dirFile.exists()) {
    FileUtils.deleteRecursive(dirFile);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

public void run()
{
  try
  {
    FileUtils.deleteRecursive(path);
    logger.info("Successfully deleted snapshot {}.", path);
  }
  catch (FSWriteError e)
  {
    failedTasks.add(this);
  }
}

代码示例来源:origin: org.cassandraunit/cassandra-unit

private static void rmdir(String dir) {
  File dirFile = new File(dir);
  if (dirFile.exists()) {
    FileUtils.deleteRecursive(dirFile);
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public void run()
{
  try
  {
    FileUtils.deleteRecursive(path);
    logger.info("Successfully deleted snapshot {}.", path);
  }
  catch (FSWriteError e)
  {
    failedTasks.add(this);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

private static void rmdir(String dir) {
  File dirFile = new File(dir);
  if (dirFile.exists()) {
    FileUtils.deleteRecursive(dirFile);
  }
}

代码示例来源:origin: me.prettyprint/hector-test

private static void rmdir(String dir) throws IOException {
 File dirFile = new File(dir);
 if (dirFile.exists()) {
  FileUtils.deleteRecursive(new File(dir));
 }
}

代码示例来源:origin: jsevellec/cassandra-unit

public void removeTemporaryDirectories()
{
  for (File dataDir : dataPaths)
  {
    File tmpDir = new File(dataDir, TMP_SUBDIR);
    if (tmpDir.exists())
    {
      logger.debug("Removing temporary directory {}", tmpDir);
      FileUtils.deleteRecursive(tmpDir);
    }
  }
}

代码示例来源:origin: lordofthejars/nosql-unit

private static void rmdir(String dir) throws IOException {
  File dirFile = new File(dir);
  if (dirFile.exists()) {
    FileUtils.deleteRecursive(new File(dir));
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public void removeTemporaryDirectories()
{
  for (File dataDir : dataPaths)
  {
    File tmpDir = new File(dataDir, TMP_SUBDIR);
    if (tmpDir.exists())
    {
      logger.debug("Removing temporary directory {}", tmpDir);
      FileUtils.deleteRecursive(tmpDir);
    }
  }
}

代码示例来源:origin: org.hectorclient/hector-test

private static void rmdir(String dir) throws IOException {
 File dirFile = new File(dir);
 if (dirFile.exists()) {
  FileUtils.deleteRecursive(new File(dir));
 }
}

代码示例来源:origin: jsevellec/cassandra-unit

private static void cleanup() {
  // clean up commitlog and data directory which are stored as data directory/table/data files
  List<String> directories = new ArrayList<>(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()));
  directories.add(DatabaseDescriptor.getCommitLogLocation());
  for (String dirName : directories) {
    File dir = new File(dirName);
    if (!dir.exists())
      throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
    FileUtils.deleteRecursive(dir);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

private static void cleanup() {
  // clean up commitlog and data directory which are stored as data directory/table/data files
  List<String> directories = new ArrayList<>(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()));
  directories.add(DatabaseDescriptor.getCommitLogLocation());
  for (String dirName : directories) {
    File dir = new File(dirName);
    if (!dir.exists())
      throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
    FileUtils.deleteRecursive(dir);
  }
}

代码示例来源:origin: org.cassandraunit/cassandra-unit

private static void cleanup() {
  // clean up commitlog and data directory which are stored as data directory/table/data files
  List<String> directories = new ArrayList<>(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()));
  directories.add(DatabaseDescriptor.getCommitLogLocation());
  for (String dirName : directories) {
    File dir = new File(dirName);
    if (!dir.exists())
      throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
    FileUtils.deleteRecursive(dir);
  }
}

相关文章