mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-29 04:57:48 +01:00
separate updateSize in JObjectLRU
This commit is contained in:
@@ -62,8 +62,6 @@ public class JObjectLRU {
|
||||
_statusExecutor.shutdownNow();
|
||||
}
|
||||
|
||||
// Called in JObjectManager getters to add into cache,
|
||||
// and when resolving/modifying to update size
|
||||
public void notifyAccess(JObject<?> obj) {
|
||||
if (obj.getData() == null) return;
|
||||
long size = jObjectSizeEstimator.estimateObjectSize(obj.getData());
|
||||
@@ -80,4 +78,11 @@ public class JObjectLRU {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSize(JObject<?> obj) {
|
||||
long size = jObjectSizeEstimator.estimateObjectSize(obj.getData());
|
||||
synchronized (_cache) {
|
||||
_cache.put(obj, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class JObjectResolver {
|
||||
}
|
||||
|
||||
public void onResolution(JObject<?> self) {
|
||||
jObjectLRU.notifyAccess(self);
|
||||
jObjectLRU.updateSize(self);
|
||||
}
|
||||
|
||||
public void removeLocal(JObject<?> jObject, String name) {
|
||||
@@ -200,7 +200,7 @@ public class JObjectResolver {
|
||||
public <T extends JObjectData> void notifyWrite(JObject<T> self, boolean metaChanged,
|
||||
boolean externalChanged, boolean hasDataChanged) {
|
||||
self.assertRWLock();
|
||||
jObjectLRU.notifyAccess(self);
|
||||
jObjectLRU.updateSize(self);
|
||||
if (metaChanged || hasDataChanged)
|
||||
jObjectWriteback.markDirty(self);
|
||||
if (metaChanged)
|
||||
|
||||
Reference in New Issue
Block a user