summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorColby Ranger <cranger@google.com>2013-11-13 15:19:03 -0800
committerColby Ranger <cranger@google.com>2013-11-13 15:19:03 -0800
commitf3b80f1a7417591eb0ad7fa2b212a0588f987441 (patch)
tree1ff88dc65a02f5d2bae5e252be35167b175d4e6a /org.eclipse.jgit
parent371e1a02bd049a7ff5bc6d6936fb1b7e296f26d3 (diff)
downloadjgit-f3b80f1a7417591eb0ad7fa2b212a0588f987441.tar.gz
jgit-f3b80f1a7417591eb0ad7fa2b212a0588f987441.zip
Do not update the ref hot bit when checking isIndexLoaded
DfsPackFile.isIndexLoaded() uses the DfsBlockCache.Ref.get() method to check if the index loaded. However, using the get() method marks a hot bit in the cache, which can cause the index to never be unloaded and seem hotter than it really is. Add a has() method which only checks if the value is not null and does not update the hot bit. Change-Id: I7e9ed216f6e273e8f5d79ae573973197654419b4
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java2
2 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
index a8d797dff2..748a4a38e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
@@ -556,5 +556,9 @@ public final class DfsBlockCache {
hot = true;
return v;
}
+
+ boolean has() {
+ return value != null;
+ }
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
index 1c588d2c4e..7c4776ea06 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
@@ -191,7 +191,7 @@ public final class DfsPackFile {
*/
public boolean isIndexLoaded() {
DfsBlockCache.Ref<PackIndex> idxref = index;
- return idxref != null && idxref.get() != null;
+ return idxref != null && idxref.has();
}
/** @return bytes cached in memory for this pack, excluding the index. */