提交 dde9ae24 authored 作者: Thomas Mueller's avatar Thomas Mueller

Try to solve memory mapped files problem.

上级 8ba62101
...@@ -162,7 +162,17 @@ public class FileObjectDiskMapped implements FileObject { ...@@ -162,7 +162,17 @@ public class FileObjectDiskMapped implements FileObject {
checkFileSizeLimit(newLength); checkFileSizeLimit(newLength);
int oldPos = pos; int oldPos = pos;
unMap(); unMap();
IOUtils.setLength(file, newLength); for (int i = 0;; i++) {
try {
IOUtils.setLength(file, newLength);
break;
} catch (IOException e) {
if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) {
throw e;
}
}
System.gc();
}
reMap(); reMap();
pos = (int) Math.min(newLength, oldPos); pos = (int) Math.min(newLength, oldPos);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论