()
| 3204 | } |
| 3205 | |
| 3206 | void clear() { |
| 3207 | if (count != 0) { // read-volatile |
| 3208 | lock(); |
| 3209 | try { |
| 3210 | long now = map.ticker.read(); |
| 3211 | preWriteCleanup(now); |
| 3212 | |
| 3213 | AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table; |
| 3214 | for (int i = 0; i < table.length(); ++i) { |
| 3215 | for (ReferenceEntry<K, V> e = table.get(i); e != null; e = e.getNext()) { |
| 3216 | // Loading references aren't actually in the map yet. |
| 3217 | if (e.getValueReference().isActive()) { |
| 3218 | K key = e.getKey(); |
| 3219 | V value = e.getValueReference().get(); |
| 3220 | RemovalCause cause = |
| 3221 | (key == null || value == null) ? RemovalCause.COLLECTED : RemovalCause.EXPLICIT; |
| 3222 | enqueueNotification( |
| 3223 | key, e.getHash(), value, e.getValueReference().getWeight(), cause); |
| 3224 | } |
| 3225 | } |
| 3226 | } |
| 3227 | for (int i = 0; i < table.length(); ++i) { |
| 3228 | table.set(i, null); |
| 3229 | } |
| 3230 | clearReferenceQueues(); |
| 3231 | writeQueue.clear(); |
| 3232 | accessQueue.clear(); |
| 3233 | readCount.set(0); |
| 3234 | |
| 3235 | ++modCount; |
| 3236 | count = 0; // write-volatile |
| 3237 | } finally { |
| 3238 | unlock(); |
| 3239 | postWriteCleanup(); |
| 3240 | } |
| 3241 | } |
| 3242 | } |
| 3243 | |
| 3244 | @GuardedBy("this") |
| 3245 | @Nullable ReferenceEntry<K, V> removeValueFromChain( |
nothing calls this directly
no test coverage detected