MCPcopy Create free account
hub / github.com/antlr/codebuff / clear

Method clear

output/java_guava/1.4.17/LocalCache.java:3284–3316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3282 }
3283
3284 void clear() {
3285 if (count != 0) { // read-volatile
3286 lock();
3287 try {
3288 long now = map.ticker.read();
3289 preWriteCleanup(now);
3290 AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table;
3291 for (int i = 0; i < table.length(); ++i) {
3292 for (ReferenceEntry<K, V> e = table.get(i); e != null; e = e.getNext()) {
3293 // Loading references aren't actually in the map yet.
3294 if (e.getValueReference().isActive()) {
3295 K key = e.getKey();
3296 V value = e.getValueReference().get();
3297 RemovalCause cause = (key == null || value == null) ? RemovalCause.COLLECTED : RemovalCause.EXPLICIT;
3298 enqueueNotification(key, e.getHash(), value, e.getValueReference().getWeight(), cause);
3299 }
3300 }
3301 }
3302 for (int i = 0; i < table.length(); ++i) {
3303 table.set(i, null);
3304 }
3305 clearReferenceQueues();
3306 writeQueue.clear();
3307 accessQueue.clear();
3308 readCount.set(0);
3309 ++modCount;
3310 count = 0; // write-volatile
3311 } finally {
3312 unlock();
3313 postWriteCleanup();
3314 }
3315 }
3316 }
3317
3318 @GuardedBy("this")
3319 @Nullable

Callers

nothing calls this directly

Calls 15

preWriteCleanupMethod · 0.95
enqueueNotificationMethod · 0.95
clearReferenceQueuesMethod · 0.95
postWriteCleanupMethod · 0.95
getMethod · 0.65
getNextMethod · 0.65
isActiveMethod · 0.65
getValueReferenceMethod · 0.65
getKeyMethod · 0.65
getHashMethod · 0.65
getWeightMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected