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
This commit is contained in:
parent
371e1a02bd
commit
f3b80f1a74
|
@ -556,5 +556,9 @@ T get() {
|
||||||
hot = true;
|
hot = true;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean has() {
|
||||||
|
return value != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public DfsPackDescription getPackDescription() {
|
||||||
*/
|
*/
|
||||||
public boolean isIndexLoaded() {
|
public boolean isIndexLoaded() {
|
||||||
DfsBlockCache.Ref<PackIndex> idxref = index;
|
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. */
|
/** @return bytes cached in memory for this pack, excluding the index. */
|
||||||
|
|
Loading…
Reference in New Issue