]> source.dussan.org Git - jgit.git/commitdiff
Unconditionally close repository in unregisterAndCloseRepository 63/81563/2
authorSaša Živkov <sasa.zivkov@sap.com>
Wed, 21 Sep 2016 09:32:36 +0000 (11:32 +0200)
committerSaša Živkov <sasa.zivkov@sap.com>
Wed, 21 Sep 2016 11:22:51 +0000 (13:22 +0200)
Repository.close() method is used when reference counting and expiration
needs to be honored. The RepositoryCache.unregisterAndCloseRepository
method should close the repository unconditionally. This is also indicated
from its javadoc.

Change-Id: I19392d1eaa17f27ae44b55eea49dcff05a52f298

org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java

index 29ef08483096211572ddcc3ed708ff4c9b2c96a2..2e0ed16a553ac99460dcd7e4f0e3b4fd71521563 100644 (file)
@@ -305,11 +305,9 @@ public class RepositoryCache {
        private void unregisterAndCloseRepository(final Key location,
                        Repository db) {
                synchronized (lockFor(location)) {
-                       if (isExpired(db)) {
-                               Repository oldDb = unregisterRepository(location);
-                               if (oldDb != null) {
-                                       oldDb.close();
-                               }
+                       Repository oldDb = unregisterRepository(location);
+                       if (oldDb != null) {
+                               oldDb.doClose();
                        }
                }
        }