-
Notifications
You must be signed in to change notification settings - Fork 788
Closed
Labels
Description
There is a curious comment about locking in
opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/FileHistoryCache.java
Lines 209 to 224 in d2e8d64
// We have a problem that multiple threads may access the cache layer | |
// at the same time. Since I would like to avoid read-locking, I just | |
// serialize the write access to the cache file. The generation of the | |
// cache file would most likely be executed during index generation, and | |
// that happens sequentially anyway.... | |
// Generate the file with a temporary name and move it into place when | |
// done, so it is not necessary to protect the readers for partially updated | |
// files... | |
final File output; | |
try { | |
output = File.createTempFile("ogtmp", null, dir); | |
CacheUtil.writeCache(object, output); | |
} catch (IOException ioe) { | |
throw new HistoryException("Failed to write history", ioe); | |
} | |
synchronized (lock) { |
I think this pertains to the times when the history cache could be generated on the fly, however this is no longer the case (#3828), so I think this lock can be removed.