in src/main/java/com/googlesource/gerrit/plugins/events/fsstore/UpdatableFileValue.java [253:268]
public void initFs(T init) throws IOException {
super.init(init);
Files.createDirectories(paths.preserved);
while (!Files.exists(path)) {
try (InitBuilder b = new InitBuilder(paths, serializer.fromGeneric(init))) {
Fs.tryAtomicMove(b.dir, paths.update); // rename build/<tmp>/ -> update/
// now there should be: update/init(init_value)
if (!Files.exists(path)) {
// using a non unique name, "init", to allow recovery below
Fs.tryAtomicMove(paths.update.resolve(INIT), path); // rename update/init(init) -> value
// now there should be: update/ and: value (file)
}
}
}
Fs.tryDelete(paths.update.resolve(INIT)); // cleanup
}