diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java index e613a5806..ad1e75312 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.TreeSet; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -107,12 +108,13 @@ public boolean hasFastTipsWithSha1() throws IOException { * @throws IOException on I/O errors */ public void compactFully() throws IOException { - reftableDatabase.getLock().lock(); + Lock l = reftableDatabase.getLock(); + l.lock(); try { reftableStack.compactFully(); reftableDatabase.clearCache(); } finally { - reftableDatabase.getLock().unlock(); + l.unlock(); } }