@Override protected boolean needsRefresh() { if (super.needsRefresh() == false) { // The size was computed recently, don't recompute return false; } SizeAndModCount cached = getNoRefresh(); if (cached.pendingWrite) { // The cached entry was generated while there were pending // writes, so the size might be stale: recompute. return true; } synchronized(ByteSizeCachingDirectory.this) { // If there are pending writes or if new files have been // written/deleted since last time: recompute return numOpenOutputs != 0 || cached.modCount != modCount; } } };
@Override protected boolean needsRefresh() { if (super.needsRefresh() == false) { // The size was computed recently, don't recompute return false; } SizeAndModCount cached = getNoRefresh(); if (cached.pendingWrite) { // The cached entry was generated while there were pending // writes, so the size might be stale: recompute. return true; } synchronized(ByteSizeCachingDirectory.this) { // If there are pending writes or if new files have been // written/deleted since last time: recompute return numOpenOutputs != 0 || cached.modCount != modCount; } } };
@Override protected boolean needsRefresh() { if (super.needsRefresh() == false) { // The size was computed recently, don't recompute return false; } SizeAndModCount cached = getNoRefresh(); if (cached.pendingWrite) { // The cached entry was generated while there were pending // writes, so the size might be stale: recompute. return true; } synchronized(ByteSizeCachingDirectory.this) { // If there are pending writes or if new files have been // written/deleted since last time: recompute return numOpenOutputs != 0 || cached.modCount != modCount; } } };