提交 4947fb34 authored 作者: Thomas Mueller's avatar Thomas Mueller

Multiple processes could open a database at the same time on Mac OS

上级 613b8ced
......@@ -273,21 +273,19 @@ public class FileLock {
}
private void waitUntilOld() throws SQLException {
for (int i = 0; i < 10; i++) {
for (int i = 0; i < TIME_GRANULARITY / SLEEP_GAP; i++) {
long last = fs.getLastModified(fileName);
long dist = System.currentTimeMillis() - last;
if (dist < -TIME_GRANULARITY) {
throw getExceptionFatal("Lock file modified in the future: dist=" + dist, null);
}
if (dist < SLEEP_GAP) {
try {
Thread.sleep(dist + 1);
} catch (Exception e) {
trace.debug("sleep", e);
}
} else {
} else if (dist > TIME_GRANULARITY) {
return;
}
try {
Thread.sleep(SLEEP_GAP);
} catch (Exception e) {
trace.debug("sleep", e);
}
}
throw getExceptionFatal("Lock file recently modified", null);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论