Copies original into a new entry chained to newNext. Returns the new entry, or null if original was already garbage collected.
(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext)
| 2221 | */ |
| 2222 | |
| 2223 | @GuardedBy("this") |
| 2224 | ReferenceEntry<K, V> copyEntry(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext) { |
| 2225 | if (original.getKey() == null) { |
| 2226 | // key collected |
| 2227 | return null; |
| 2228 | } |
| 2229 | ValueReference<K, V> valueReference = original.getValueReference(); |
| 2230 | V value = valueReference.get(); |
| 2231 | if ((value == null) && valueReference.isActive()) { |
| 2232 | // value collected |
| 2233 | return null; |
| 2234 | } |
| 2235 | ReferenceEntry<K, V> newEntry = map.entryFactory.copyEntry(this, original, newNext); |
| 2236 | newEntry.setValueReference(valueReference.copyFor(this.valueReferenceQueue, value, newEntry)); |
| 2237 | return newEntry; |
| 2238 | } |
| 2239 | |
| 2240 | /** |
| 2241 | * Sets a new value of an entry. Adds newly created entries at the end of the access queue. |
no test coverage detected