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

Method copyEntry

output/java_guava/1.4.13/LocalCache.java:2218–2233  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

refreshMethod · 0.95

Calls 7

getKeyMethod · 0.65
getValueReferenceMethod · 0.65
getMethod · 0.65
isActiveMethod · 0.65
setValueReferenceMethod · 0.65
copyForMethod · 0.65
copyEntryMethod · 0.45

Tested by

no test coverage detected