org.apache.activemq.artemis.utils.FileUtil类的使用及代码示例

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

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

FileUtil介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: apache/activemq-artemis

private void makeExec(String path) throws IOException {
 FileUtil.makeExec(new File(directory, path));
}

代码示例来源:origin: org.apache.activemq/artemis-cli

private void makeExec(String path) throws IOException {
 FileUtil.makeExec(new File(directory, path));
}

代码示例来源:origin: apache/activemq-artemis

@Override
public synchronized void removeFileFactory(SequentialFileFactory fileFactory) throws Exception {
 File directory = fileFactory.getDirectory();
 if (directory.exists()) {
   FileUtil.deleteDirectory(directory);
 }
}

代码示例来源:origin: apache/activemq-artemis

FileUtil.makeExec(commandLine);

代码示例来源:origin: apache/activemq-artemis

protected static final boolean deleteDirectory(final File directory) {
 return FileUtil.deleteDirectory(directory);
}

代码示例来源:origin: apache/activemq-artemis

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: org.apache.activemq/artemis-commons

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: apache/activemq-artemis

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: apache/activemq-artemis

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public static final boolean deleteDirectory(final File directory) {
 if (directory.isDirectory()) {
   String[] files = directory.list();
   int num = 5;
   int attempts = 0;
   while (files == null && (attempts < num)) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
    }
    files = directory.list();
    attempts++;
   }
   if (files == null) {
    ActiveMQUtilLogger.LOGGER.failedListFilesToCleanup(directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       ActiveMQUtilLogger.LOGGER.failedToCleanupFile(f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}

代码示例来源:origin: apache/activemq-artemis

FileUtil.deleteDirectory(tmpdir);
if (tmpdir.exists()) {
 ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir);

代码示例来源:origin: org.apache.activemq/artemis-web

public void internalStop() throws Exception {
 server.stop();
 if (webContexts != null) {
   File tmpdir = null;
   for (WebAppContext context : webContexts) {
    tmpdir = context.getTempDirectory();
    if (tmpdir != null && !context.isPersistTempDirectory()) {
      //tmpdir will be removed by deleteOnExit()
      //somehow when broker is stopped and restarted quickly
      //this tmpdir won't get deleted sometimes
      boolean fileDeleted = TimeUtils.waitOnBoolean(false, 5000, tmpdir::exists);
      if (!fileDeleted) {
       //because the execution order of shutdown hooks are
       //not determined, so it's possible that the deleteOnExit
       //is executed after this hook, in that case we force a delete.
       FileUtil.deleteDirectory(tmpdir);
       logger.debug("Force to delete temporary file on shutdown: " + tmpdir.getAbsolutePath());
       if (tmpdir.exists()) {
         ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir);
       }
      }
    }
   }
   webContexts.clear();
 }
}

代码示例来源:origin: apache/activemq-artemis

@Before
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
}

代码示例来源:origin: apache/activemq-artemis

@Before
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
}

代码示例来源:origin: apache/activemq-artemis

@Before
public void removeFolder() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
}

代码示例来源:origin: apache/activemq-artemis

@Before
public void removeFolder() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
}

代码示例来源:origin: apache/activemq-artemis

@Before
@Override
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
 File file = serverFolder.newFile(ActiveMQJMSClient.class.getName() + ".properties");
 FileOutputStream fileOutputStream = new FileOutputStream(file);
 PrintStream stream = new PrintStream(fileOutputStream);
 stream.println("enable1xPrefixes=true");
 stream.close();
 setVariable(serverClassloader, "persistent", Boolean.FALSE);
 startServer(serverFolder.getRoot(), serverClassloader, "live");
}

代码示例来源:origin: apache/activemq-artemis

@Before
public void beforeTest() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
 setVariable(senderClassloader, "persistent", false);
}

相关文章