aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Arès <hugo.ares@ericsson.com>2015-09-08 09:21:31 -0400
committerMatthias Sohn <matthias.sohn@sap.com>2016-04-07 11:32:57 +0200
commit53ea86cd7be3859ff741ea2b9760396ffabf5fe0 (patch)
tree7f99d3c74df2e26ea5e2b1847e4b24322151f8a7
parent83235432e7fd789261cad7729bf3febfc168cd6f (diff)
downloadjgit-53ea86cd7be3859ff741ea2b9760396ffabf5fe0.tar.gz
jgit-53ea86cd7be3859ff741ea2b9760396ffabf5fe0.zip
Fix RefDirectory not closing resources
When repositories are opened using the RepositoryCache, they are kept in memory and when the repository usage counter reaches 0, the Repository.close method is called which then calls close method on its reference and object databases. The problem is that RefDirectory.close method was a no-op and the reference database was kept in memory. This problem is only happening when opening a repository using the RepositoryCache because it never evicts repositories, it's just calling the close method. Change-Id: Iacb961de8e8b1f5b37824bf0d1a4caf4c6f1233f Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index b8c2fb4a51..6f3166a680 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -203,10 +203,10 @@ public class RefDirectory extends RefDatabase {
@Override
public void close() {
- // We have no resources to close.
+ clearReferences();
}
- void rescan() {
+ private void clearReferences() {
looseRefs.set(RefList.<LooseRef> emptyList());
packedRefs.set(PackedRefList.NO_PACKED_REFS);
}
@@ -214,7 +214,7 @@ public class RefDirectory extends RefDatabase {
@Override
public void refresh() {
super.refresh();
- rescan();
+ clearReferences();
}
@Override