mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
to avoid persistent hash map corruption sync stream on closing file handle used for output
This commit is contained in:
@@ -76,6 +76,7 @@ public class PersistentHashMapValueStorage {
|
||||
|
||||
@Override
|
||||
protected void disposeAccessor(DataOutputStream fileAccessor) throws IOException {
|
||||
if (!useSingleFileDescriptor) IOUtil.syncStream(fileAccessor);
|
||||
fileAccessor.close();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -178,6 +178,7 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Closed:" + this + "," + Thread.currentThread() );
|
||||
}
|
||||
force();
|
||||
super.close();
|
||||
}
|
||||
|
||||
@@ -185,4 +186,12 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
|
||||
public String toString() {
|
||||
return myPath + "@" + Integer.toHexString(hashCode());
|
||||
}
|
||||
|
||||
public void force() throws IOException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Forcing:" + this + "," + Thread.currentThread() );
|
||||
}
|
||||
|
||||
getFD().sync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user