send CSV file via REST

This commit is contained in:
2019-12-08 18:39:34 +01:00
parent f1ef13c1de
commit 85679ca0c8
12 changed files with 334 additions and 48 deletions

View File

@@ -25,9 +25,9 @@ public class DiskStorage implements AutoCloseable {
private final FileChannel fileChannel;
private Path relativeDatabaseFileForLogging;
private final Path relativeDatabaseFileForLogging;
public DiskStorage(final Path databaseFile, Path storageBasePath) {
public DiskStorage(final Path databaseFile, final Path storageBasePath) {
this.relativeDatabaseFileForLogging = storageBasePath != null ? storageBasePath.relativize(databaseFile)
: databaseFile;
try {
@@ -66,10 +66,12 @@ public class DiskStorage implements AutoCloseable {
}
@Override
public void close() {
public synchronized void close() {
try {
fileChannel.force(true);
fileChannel.close();
if (fileChannel.isOpen()) {
fileChannel.force(true);
fileChannel.close();
}
} catch (final IOException e) {
throw new DiskStorageException(e);
}