FileUtil.deleteDirectory
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.activemq.artemis.utils.FileUtil.deleteDirectory(Showing top 15 results out of 315)

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) {
    logger.warn("Could not list files to clean up in: " + directory.getAbsolutePath());
   } else {
    for (String file : files) {
      File f = new File(directory, file);
      if (!deleteDirectory(f)) {
       logger.warn("Failed to clean up file: " + f.getAbsolutePath());
      }
    }
   }
 }
 return directory.delete();
}
origin: apache/activemq-artemis

@Before
public void removeFolder() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
}
origin: apache/activemq-artemis

@Before
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
}
origin: apache/activemq-artemis

protected static final boolean deleteDirectory(final File directory) {
 return FileUtil.deleteDirectory(directory);
}
origin: apache/activemq-artemis

public static ActiveMQServer startServer() throws Exception {
 if (server == null) {
   Configuration config = new ConfigurationImpl().addAcceptorConfiguration("netty", "tcp://localhost:61616").setSecurityEnabled(false).addConnectorConfiguration("netty", "tcp://localhost:61616");
   File dataPlace = new File("./target/dataJoram");
   FileUtil.deleteDirectory(dataPlace);
   config.setJournalDirectory(new File(dataPlace, "./journal").getAbsolutePath()).
    setPagingDirectory(new File(dataPlace, "./paging").getAbsolutePath()).
    setLargeMessagesDirectory(new File(dataPlace, "./largemessages").getAbsolutePath()).
    setBindingsDirectory(new File(dataPlace, "./bindings").getAbsolutePath()).setPersistenceEnabled(true);
   // disable server persistence since JORAM tests do not restart server
   server = ActiveMQServers.newActiveMQServer(config, useFiles);
   serverManager = new JMSServerManagerImpl(server);
   serverManager.start();
 }
 return server;
}
origin: apache/activemq-artemis

@Before
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 setVariable(serverClassloader, "persistent", Boolean.FALSE);
 startServer(serverFolder.getRoot(), serverClassloader, "live");
}
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 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 beforeTest() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
 setVariable(senderClassloader, "persistent", false);
 startServer(serverFolder.getRoot(), senderClassloader, "1");
}
origin: apache/activemq-artemis

@Before
public void setUp() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 evaluate(serverClassloader, "hqfailovertest/hornetqServer.groovy", serverFolder.getRoot().getAbsolutePath());
}
origin: apache/activemq-artemis

@Before
public void removeFolder() throws Throwable {
 FileUtil.deleteDirectory(serverFolder.getRoot());
 serverFolder.getRoot().mkdirs();
}
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();
}
org.apache.activemq.artemis.utilsFileUtildeleteDirectory

Popular methods of FileUtil

  • makeExec

Popular classes and methods

  • getContentResolver (Context)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • GridLayout (java.awt)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • ImageIO (javax.imageio)
  • JComboBox (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)