org.apache.commons.io.FileUtils.waitFor()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(201)

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

FileUtils.waitFor介绍

[英]Waits for NFS to propagate a file creation, imposing a timeout.

This method repeatedly tests File#exists() until it returns true up to the maximum time specified in seconds.
[中]等待NFS传播文件创建,并施加超时。
此方法重复测试文件#exists(),直到它返回true,直到指定的最长时间(以秒为单位)。

代码示例

代码示例来源:origin: commons-io/commons-io

@Test
public void testWaitFor() {
  FileUtils.waitFor(new File(""), -1);
  FileUtils.waitFor(new File(""), 2);
}

代码示例来源:origin: commons-io/commons-io

@Override
  public void run() {
    started.countDown();
    FileUtils.waitFor(new File(""), 2);
    wasInterrupted.set( Thread.currentThread().isInterrupted());
  }
};

代码示例来源:origin: galenframework/galen

public static void makeSureFolderExists(File dir) throws IOException {
    FileUtils.forceMkdir(dir);
    if (!FileUtils.waitFor(dir, GalenConfig.getConfig().getIntProperty(FILE_CREATE_TIMEOUT))) {
      throw new IOException(format("Couldn't create folder: %s", dir.getAbsolutePath()));
    }
  }
}

代码示例来源:origin: org.restcomm/restcomm-connect.commons

private boolean fileExists(final File file) {
  if (file.exists()) {
    return true;
  } else {
    return FileUtils.waitFor(file, 2);
  }
}

代码示例来源:origin: pl.allegro.tech/embedded-elasticsearch

private void waitForDownload(File target, File statusFile) throws IOException {
  boolean downloaded;
  do {
    logger.info("File {} (size={}) is probably being downloaded by another thread/jvm. Waiting ...", target, target.length());
    downloaded = FileUtils.waitFor(statusFile, 30);
  } while (!downloaded && maybeDownloading(target));
  if (!downloaded) {
    throw new IOException("Broken download. Another party probably failed to download " + target);
  }
  logger.info("File was downloaded by another thread/jvm. Download skipped");
}

代码示例来源:origin: com.galenframework/galen-core

public static void makeSureFolderExists(File dir) throws IOException {
    FileUtils.forceMkdir(dir);
    if (!FileUtils.waitFor(dir, GalenConfig.getConfig().getIntProperty(FILE_CREATE_TIMEOUT))) {
      throw new IOException(format("Couldn't create folder: %s", dir.getAbsolutePath()));
    }
  }
}

代码示例来源:origin: org.geoserver.community/gs-wps-remote

FileUtils.waitFor(tempFile, 5);

代码示例来源:origin: broadgsa/gatk

Assert.assertTrue(FileUtils.waitFor(outFile, 120), "File not found: " + outFile.getAbsolutePath());
System.out.println("--- output ---");
System.out.println(FileUtils.readFileToString(outFile));

代码示例来源:origin: broadgsa/gatk

Assert.assertTrue(FileUtils.waitFor(outFile, 120), "File not found: " + outFile.getAbsolutePath());
System.out.println("--- output ---");
System.out.println(FileUtils.readFileToString(outFile));

代码示例来源:origin: broadgsa/gatk

Assert.assertTrue(FileUtils.waitFor(outFile, 120), "File not found: " + outFile.getAbsolutePath());
System.out.println("--- output ---");
System.out.println(FileUtils.readFileToString(outFile));

相关文章

微信公众号

最新文章

更多

FileUtils类方法