mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-234 as agreeded changed method name to "putWithMapping()"
This commit is contained in:
@@ -30,7 +30,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* Extension of {@link ConcurrentMap} interface, stores the data off-heap.
|
||||
@@ -202,14 +201,14 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>, ChronicleHash {
|
||||
|
||||
/**
|
||||
* Apply a mutator to the value for a key and return a result. A write lock is assumed. <p> If
|
||||
* there is no entry for this key it will be created and the value empty.
|
||||
* there is no entry for this key null will be returned
|
||||
*
|
||||
* @param <R> return type.
|
||||
* @param key to apply the mapping to
|
||||
* @param mutator to alter the value and calculate a result
|
||||
* @return the result of the function.
|
||||
*/
|
||||
<R> R putWithMapping(K key, @NotNull Mutator<? super V, R> mutator);
|
||||
<R> R putWith(K key, @NotNull Mutator<? super V, R> mutator);
|
||||
|
||||
/**
|
||||
* exports all the entries to a {@link java.io.File} storing them in JSON format, an attempt is
|
||||
|
||||
@@ -757,14 +757,13 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
|
||||
}
|
||||
|
||||
|
||||
|
||||
RV result =createEntryOnAcquire(copies, localSegmentState,
|
||||
RV result = createEntryOnAcquire(copies, localSegmentState,
|
||||
metaKeyInterop, keyInterop, key, keySize, toKey,
|
||||
readValue, usingValue, toValue, entry);
|
||||
|
||||
// notify the context that the entry was created
|
||||
if (lock instanceof WriteLocked)
|
||||
((WriteLocked) lock).wasPresent(true);
|
||||
((WriteLocked) lock).wasPresent(false);
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <R> R putWithMapping(@Nullable K key, @NotNull Mutator<? super V, R> mutator) {
|
||||
public <R> R putWith(@Nullable K key, @NotNull Mutator<? super V, R> mutator) {
|
||||
if (key == null)
|
||||
throw keyNotNullNPE();
|
||||
return fetchObject(UPDATE_FOR_KEY, key, mutator);
|
||||
|
||||
@@ -1442,7 +1442,7 @@ class StatelessServerConnector<K, V> {
|
||||
final K key = keyReaderWithSize.read(reader, null);
|
||||
final Mutator<V, ?> mutator = (Mutator<V, ?>) reader.readObject();
|
||||
try {
|
||||
Object result = map.putWithMapping(key, mutator);
|
||||
Object result = map.putWith(key, mutator);
|
||||
writer.writeObject(result);
|
||||
} catch (Throwable e) {
|
||||
LOG.info("", e);
|
||||
|
||||
@@ -559,7 +559,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> R putWithMapping(K key, @NotNull Mutator<? super V, R> mutator) {
|
||||
public <R> R putWith(K key, @NotNull Mutator<? super V, R> mutator) {
|
||||
|
||||
|
||||
if (!(CharSequence.class.isAssignableFrom(vClass))) {
|
||||
@@ -575,8 +575,8 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
|
||||
R result = mutator.update(entry.value());
|
||||
((MutableLockedEntry) entry).value(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2707,7 +2707,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
extends MutableLockedEntry<K, KI, MKI, V, VI, MVI>
|
||||
implements WriteContext<K, V> {
|
||||
|
||||
private boolean wasPresent;
|
||||
private boolean wasPresent = true;
|
||||
|
||||
WriteLocked(SegmentState segmentState) {
|
||||
super(segmentState);
|
||||
|
||||
Reference in New Issue
Block a user