send CSV file via REST
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user