diff options
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java | 14 |
1 files changed, 4 insertions, 10 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 e5a0553ab4..9a57349f56 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java @@ -298,7 +298,7 @@ public class RepositoryCache { } private boolean isExpired(Repository db) { - return db != null && db.useCnt.get() == 0 + return db != null && db.useCnt.get() <= 0 && (System.currentTimeMillis() - db.closedAt.get() > expireAfter); } @@ -325,15 +325,9 @@ public class RepositoryCache { } private void clearAll() { - for (int stage = 0; stage < 2; stage++) { - for (Iterator<Map.Entry<Key, Reference<Repository>>> i = cacheMap - .entrySet().iterator(); i.hasNext();) { - final Map.Entry<Key, Reference<Repository>> e = i.next(); - final Repository db = e.getValue().get(); - if (db != null) - db.close(); - i.remove(); - } + for (Iterator<Map.Entry<Key, Reference<Repository>>> i = cacheMap + .entrySet().iterator(); i.hasNext();) { + unregisterAndCloseRepository(i.next().getKey()); } } |