]> source.dussan.org Git - jgit.git/commit
Add ShutdownHook to cleanup FileLocks on graceful JVM shutdown 13/204213/12
authorMatthias Sohn <matthias.sohn@sap.com>
Fri, 8 Sep 2023 00:14:20 +0000 (02:14 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 12 Sep 2023 20:43:15 +0000 (22:43 +0200)
commitd4d6c2b5af9b984ae824fb0073e1b368b39b1aa4
tree9c9b1b4495c499e8aa89874c3dc5d0a7d3b014f6
parentf94be665f12d85304db056c6cb8934870de3e45a
Add ShutdownHook to cleanup FileLocks on graceful JVM shutdown

This should avoid stale lock files if the JVM is terminated gracefully.

Implement a ShutdownHook which can register/unregister listeners which
need to do some cleanup during graceful JVM shutdown. This hook is
registered as a Java shutdown hook and  when the JVM shuts down
calls #onShutdown of registered listeners using a parallel stream
to let them run concurrently.

See https://docs.oracle.com/javase/8/docs/technotes/guides/lang/hook-design.html

Bug: 582379
Change-Id: I1621dc5f7d9a8c832b6d1b74cbc47578b1c2f0b8
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/util/ShutdownHook.java [new file with mode: 0644]