Java Code Examples for org.apache.kafka.common.utils.Utils#delete()

The following examples show how to use org.apache.kafka.common.utils.Utils#delete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegrationTestUtils.java    From ksql-fork-with-deep-learning-function with Apache License 2.0 5 votes vote down vote up
/**
 * Removes local state stores.  Useful to reset state in-between integration test runs.
 *
 * @param streamsConfiguration Streams configuration settings
 */
public static void purgeLocalStreamsState(final Properties streamsConfiguration) throws
        IOException {
  final String tmpDir = TestUtils.IO_TMP_DIR.getPath();
  final String path = streamsConfiguration.getProperty(StreamsConfig.STATE_DIR_CONFIG);
  if (path != null) {
    final File node = Paths.get(path).normalize().toFile();
    // Only purge state when it's under java.io.tmpdir.  This is a safety net to prevent accidentally
    // deleting important local directory trees.
    if (node.getAbsolutePath().startsWith(tmpDir)) {
      Utils.delete(new File(node.getAbsolutePath()));
    }
  }
}
 
Example 2
Source File: RocksDBCache.java    From kcache with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void destroy() throws IOException {
    Utils.delete(new File(rootDir + File.separator + parentDir + File.separator + name));
}
 
Example 3
Source File: KafkaApplication.java    From spring-cloud-cli with Apache License 2.0 4 votes vote down vote up
void shutdown() throws Exception {
	zookeeper.shutdown();
	factory.shutdown();
	Utils.delete(logDir);
	Utils.delete(snapshotDir);
}
 
Example 4
Source File: KafkaEmbeddedRule.java    From devicehive-java-server with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
    zooKeeperServer.shutdown();
    nioServerCnxnFactory.shutdown();
    Utils.delete(logDir);
    Utils.delete(snapshotDir);
}