diff options
author | Hugo Arès <hugo.ares@ericsson.com> | 2015-09-18 14:05:23 -0400 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-04-07 13:00:50 +0200 |
commit | 7d2b3b9e25a430241a2d277e0cb222ad40cd0c2c (patch) | |
tree | 15157f6150889fb24070b249f300dfa6086121d6 /org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature | |
parent | 53ea86cd7be3859ff741ea2b9760396ffabf5fe0 (diff) | |
download | jgit-7d2b3b9e25a430241a2d277e0cb222ad40cd0c2c.tar.gz jgit-7d2b3b9e25a430241a2d277e0cb222ad40cd0c2c.zip |
Remove repository from cache when it's closed
RepositoryCache has 2 methods to remove a repository from the cache but
they are never called when a repository is closed. Users of the cache
were expected to call one of those 2 methods but how could they have
called them at proper time without having visibility of the repository
usage count.
Ideally, I would have reworked the RepositoryCache to wrap any
repository it opens in a class that would be responsible to unregister
them from the cache when it's really closed, i.e. when usage counter
reaches 0. The problem preventing the wrapping solution is the
RepositoryCache.register method that allows to register an already
opened repository in the cache. Such repositories cannot be wrapped
because callers are still holding a reference on the unwrapped
repository.
Document that RepositoryCache.close method is removing the repository
from the cache as well as closing it and rework
RepositoryCache.unregister method to only remove the repository from the
cache. Use the latter to unregister repository when Repository.doClose
is getting executed.
Change-Id: Ia364816e4da8d7b6cfa72f10758ca31aa8a1f9db
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature')
0 files changed, 0 insertions, 0 deletions