Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaša Živkov2016-09-21 09:32:36 +0000
committerSaša Živkov2016-09-21 11:22:51 +0000
commitb7df7d1fd38d6eba77514b0cd4154c530dfa1098 (patch)
tree0c9a20dea5755bda477bbb928b46244b5fcb2e3a
parentaadbb158e10ccc3194c4e7f2c1b3885b3c40571c (diff)
downloadjgit-b7df7d1fd38d6eba77514b0cd4154c530dfa1098.tar.gz
jgit-b7df7d1fd38d6eba77514b0cd4154c530dfa1098.tar.xz
jgit-b7df7d1fd38d6eba77514b0cd4154c530dfa1098.zip
Unconditionally close repository in unregisterAndCloseRepository
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
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
index 29ef084830..2e0ed16a55 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
@@ -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();
}
}
}

Back to the top