]> source.dussan.org Git - jgit.git/commit
Remove stray files (probes or lock files) created by background threads 79/193379/2
authorJames Z.M. Gao <gzm55@hotmail.com>
Thu, 7 Apr 2022 16:29:39 +0000 (00:29 +0800)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 26 May 2022 23:20:16 +0000 (01:20 +0200)
commitd67ac798f10254d038c49244e7f1e2323afdfdfc
treee8eeed169fdb538e18558ab728d434be137be8f3
parent78c9b9260a5287d09c87b407e396021590714513
Remove stray files (probes or lock files) created by background threads

NOTE: port back from master branch.

On process exit, it was possible that the filesystem timestamp
resolution measurement left behind .probe files or even a lock file
for the jgit.config.

Ensure the SAVE_RUNNER is shut down when the process exits (via
System.exit() or otherwise). Move lf.lock() into the try-finally
block when saving the config file.

Delete .probe files on JVM shutdown -- they are created in daemon
threads that may terminate abruptly, not executing the "finally"
clause that normally removes these files.

Bug: 579445
Change-Id: Iaee2301eb14e6201406398a90228ad10cfea6098
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java