private static void deleteTempDirectory() { if (tempFolder != null) { try { FileUtil.deleteFolder(tempFolder); } catch (final IOException e) { e.printStackTrace(); } } } }
private static void deleteSnapshots(final File parentDir) { final File snapshotDirectory = new File(parentDir, SNAPSHOTS_DIRECTORY); if (snapshotDirectory.exists()) { try { FileUtil.deleteFolder(snapshotDirectory.getAbsolutePath()); } catch (final IOException e) { throw new RuntimeException( "Could not delete snapshot directory " + snapshotDirectory.getAbsolutePath(), e); } } }
private static void deleteSnapshots(final File parentDir) { final File snapshotDirectory = new File(parentDir, SNAPSHOTS_DIRECTORY); if (snapshotDirectory.exists()) { try { FileUtil.deleteFolder(snapshotDirectory.getAbsolutePath()); } catch (final IOException e) { throw new RuntimeException( "Could not delete snapshot directory " + snapshotDirectory.getAbsolutePath(), e); } } }
@Override public void purgeAll(Predicate<StateSnapshotMetadata> matcher) throws Exception { final List<StateSnapshotMetadata> others = storage.list(matcher); for (final StateSnapshotMetadata other : others) { FileUtil.deleteFolder(storage.getSnapshotDirectoryFor(other).getAbsolutePath()); LOG.trace("Purged snapshot {}", other); } }
@Override public void purgeAll(Predicate<StateSnapshotMetadata> matcher) throws Exception { final List<StateSnapshotMetadata> others = storage.list(matcher); for (final StateSnapshotMetadata other : others) { FileUtil.deleteFolder(storage.getSnapshotDirectoryFor(other).getAbsolutePath()); LOG.trace("Purged snapshot {}", other); } }
@Override protected void after() { try { LOG.info("Test execution time: " + (System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); stopBroker(); LOG.info("Broker closing time: " + (System.currentTimeMillis() - startTime)); final long allocatedMemoryInKb = DirectBufferAllocator.getAllocatedMemoryInKb(); if (allocatedMemoryInKb > 0) { LOG.warn( "There are still allocated direct buffers of a total size of {}kB.", allocatedMemoryInKb); } } finally { try { FileUtil.deleteFolder(newTemporaryFolder.getAbsolutePath()); } catch (final IOException e) { e.printStackTrace(); } } }
@Override protected void after() { try { LOG.info("Test execution time: " + (System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); stopBroker(); LOG.info("Broker closing time: " + (System.currentTimeMillis() - startTime)); final long allocatedMemoryInKb = DirectBufferAllocator.getAllocatedMemoryInKb(); if (allocatedMemoryInKb > 0) { LOG.warn( "There are still allocated direct buffers of a total size of {}kB.", allocatedMemoryInKb); } } finally { try { FileUtil.deleteFolder(newTemporaryFolder.getAbsolutePath()); } catch (final IOException e) { e.printStackTrace(); } } }
private static void deleteSnapshots(final File parentDir) { final File snapshotDirectory = new File(parentDir, SNAPSHOTS_DIRECTORY); if (snapshotDirectory.exists()) { try { FileUtil.deleteFolder(snapshotDirectory.getAbsolutePath()); } catch (final IOException e) { throw new RuntimeException( "Could not delete snapshot directory " + snapshotDirectory.getAbsolutePath(), e); } } }
private static void deleteSnapshots(final File parentDir) { final File snapshotDirectory = new File(parentDir, SNAPSHOTS_DIRECTORY); if (snapshotDirectory.exists()) { try { FileUtil.deleteFolder(snapshotDirectory.getAbsolutePath()); } catch (final IOException e) { throw new RuntimeException( "Could not delete snapshot directory " + snapshotDirectory.getAbsolutePath(), e); } } }
@Override public StateSnapshotMetadata recover( long commitPosition, int term, Predicate<StateSnapshotMetadata> filter) throws Exception { final File runtimeDirectory = storage.getRuntimeDirectory(); final List<StateSnapshotMetadata> snapshots = storage.listRecoverable(commitPosition); StateSnapshotMetadata recoveredMetadata = null; if (!snapshots.isEmpty()) { recoveredMetadata = snapshots.stream() .sorted(Comparator.reverseOrder()) .filter(filter) .findFirst() .orElse(null); } if (runtimeDirectory.exists()) { FileUtil.deleteFolder(runtimeDirectory.getAbsolutePath()); } if (recoveredMetadata != null) { final File snapshotPath = storage.getSnapshotDirectoryFor(recoveredMetadata); copySnapshot(runtimeDirectory, snapshotPath); } else { recoveredMetadata = StateSnapshotMetadata.createInitial(term); } return recoveredMetadata; }
@Override public StateSnapshotMetadata recover( long commitPosition, int term, Predicate<StateSnapshotMetadata> filter) throws Exception { final File runtimeDirectory = storage.getRuntimeDirectory(); final List<StateSnapshotMetadata> snapshots = storage.listRecoverable(commitPosition); StateSnapshotMetadata recoveredMetadata = null; if (!snapshots.isEmpty()) { recoveredMetadata = snapshots.stream() .sorted(Comparator.reverseOrder()) .filter(filter) .findFirst() .orElse(null); } if (runtimeDirectory.exists()) { FileUtil.deleteFolder(runtimeDirectory.getAbsolutePath()); } if (recoveredMetadata != null) { final File snapshotPath = storage.getSnapshotDirectoryFor(recoveredMetadata); copySnapshot(runtimeDirectory, snapshotPath); } else { recoveredMetadata = StateSnapshotMetadata.createInitial(term); } return recoveredMetadata; }
@Override protected void after() { try { LOG.info("Test execution time: " + (System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); stopBroker(); LOG.info("Broker closing time: " + (System.currentTimeMillis() - startTime)); final long allocatedMemoryInKb = DirectBufferAllocator.getAllocatedMemoryInKb(); if (allocatedMemoryInKb > 0) { LOG.warn( "There are still allocated direct buffers of a total size of {}kB.", allocatedMemoryInKb); } } finally { try { FileUtil.deleteFolder(newTemporaryFolder.getAbsolutePath()); } catch (final IOException e) { e.printStackTrace(); } controlledActorClock.reset(); } }
@Override public void close() { segmentCountMetric.close(); totalBytesMetric.close(); ensureOpenedStorage(); logSegments.closeAll(); if (config.isDeleteOnClose()) { final String logPath = config.getPath(); try { FileUtil.deleteFolder(logPath); } catch (final Exception e) { LOG.error("Failed to delete folder {}: {}", logPath, e); } } dirtySegmentId = -1; state = STATE_CLOSED; }
try { FileUtil.deleteFolder(partitionDirectory.getAbsolutePath()); } catch (IOException e1) { e1.printStackTrace();
@Override protected void after() { try { LOG.info("Test execution time: " + (System.currentTimeMillis() - startTime)); startTime = System.currentTimeMillis(); stopBroker(); LOG.info("Broker closing time: " + (System.currentTimeMillis() - startTime)); final long allocatedMemoryInKb = DirectBufferAllocator.getAllocatedMemoryInKb(); if (allocatedMemoryInKb > 0) { LOG.warn( "There are still allocated direct buffers of a total size of {}kB.", allocatedMemoryInKb); } } finally { try { FileUtil.deleteFolder(newTemporaryFolder.getAbsolutePath()); } catch (final IOException e) { e.printStackTrace(); } controlledActorClock.reset(); } }
@Override public void close() { segmentCountMetric.close(); totalBytesMetric.close(); ensureOpenedStorage(); logSegments.closeAll(); if (config.isDeleteOnClose()) { final String logPath = config.getPath(); try { FileUtil.deleteFolder(logPath); } catch (final Exception e) { LOG.error("Failed to delete folder {}: {}", logPath, e); } } dirtySegmentId = -1; state = STATE_CLOSED; }
try { FileUtil.deleteFolder(partitionDirectory.getAbsolutePath()); } catch (IOException e1) { e1.printStackTrace();