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)
| 2216 | */ |
| 2217 | |
| 2218 | @GuardedBy("this") |
| 2219 | ReferenceEntry<K, V> copyEntry(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext) { |
| 2220 | if (original.getKey() == null) { |
| 2221 | // key collected |
| 2222 | return null; |
| 2223 | } |
| 2224 | ValueReference<K, V> valueReference = original.getValueReference(); |
| 2225 | V value = valueReference.get(); |
| 2226 | if ((value == null) && valueReference.isActive()) { |
| 2227 | // value collected |
| 2228 | return null; |
| 2229 | } |
| 2230 | ReferenceEntry<K, V> newEntry = map.entryFactory.copyEntry(this, original, newNext); |
| 2231 | newEntry.setValueReference(valueReference.copyFor(this.valueReferenceQueue, value, newEntry)); |
| 2232 | return newEntry; |
| 2233 | } |
| 2234 | |
| 2235 | /** |
| 2236 | * Sets a new value of an entry. Adds newly created entries at the end of the access queue. |
no test coverage detected