]> source.dussan.org Git - jgit.git/commit
LockFile: create OutputStream only when needed 98/180198/4
authorThomas Wolf <thomas.wolf@paranor.ch>
Tue, 4 May 2021 21:48:56 +0000 (23:48 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 7 May 2021 10:10:47 +0000 (12:10 +0200)
commita9579ba60cd2fd72179dfd8c2c37d389db5ec402
treeb4f9f8cfeadee8a11bc9cbc09afb01ff2ea79e4e
parent730b5d500961db3792445a3bdedddbef93effdb7
LockFile: create OutputStream only when needed

Don't create the stream eagerly in lock(); that may cause JGit to
exceed OS or JVM limits on open file descriptors if many locks need
to be created, for instance when creating many refs. Instead create
the output stream only when one really needs to write something.

Bug: 573328
Change-Id: If9441ed40494d46f594a896d34a5c4f56f91ebf4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java
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