Remove ChronicleMap.putMapped() as a duplicate of computeIfPresent(); Reduce the number of ignored tests

This commit is contained in:
leventov
2015-09-27 15:41:07 +03:00
parent 22b964e069
commit 440b075f9d
14 changed files with 149 additions and 297 deletions
@@ -18,7 +18,6 @@ package net.openhft.chronicle.map;
import net.openhft.chronicle.hash.function.SerializableFunction;
import net.openhft.chronicle.hash.impl.util.CharSequences;
import net.openhft.chronicle.map.impl.IterationContextInterface;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -43,25 +42,6 @@ interface AbstractChronicleMap<K, V> extends ChronicleMap<K, V>, Serializable {
}
}
@Override
default V putMapped(K key, @NotNull UnaryOperator<V> unaryOperator) {
requireNonNull(unaryOperator);
try (ExternalMapQueryContext<K, V, ?> c = queryContext(key)) {
// putMapped() should find a value, update & put most of the time,
// so don't try to check key presence under read lock first,
// as in putIfAbsent()/acquireUsing(), start with update lock:
c.updateLock().lock();
MapEntry<K, V> entry = c.entry();
if (entry != null) {
V newValue = unaryOperator.update(entry.value().get());
c.replaceValue(entry, c.wrapValueAsData(newValue));
return newValue;
} else {
return null;
}
}
}
@Override
default void getAll(File toFile) throws IOException {
synchronized (this) {