mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
removed getLater(0 putLater() and removeLater() because the stateless client is now mulithreaded
This commit is contained in:
@@ -211,68 +211,6 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>, ChronicleHash {
|
||||
*/
|
||||
<R> R updateForKey(K key, @NotNull Mutator<? super V, R> mutator);
|
||||
|
||||
/**
|
||||
* Returns a {@link java.util.concurrent.Future} containing the value to which the specified key
|
||||
* is mapped, or {@code null} if this map contains no mapping for the key. This method behaves
|
||||
* the same as {@link java.util.Map#get(java.lang.Object)} yet wraps result in a future a {@link
|
||||
* java.util.concurrent.Future}.
|
||||
*
|
||||
* Calling this method may or may not block until the operating is complete depending on the
|
||||
* implementation.
|
||||
*
|
||||
* @param key the key whose associated value is to be returned in the future
|
||||
* @return a future containing the value to which the specified key is mapped after this method
|
||||
* call, or {@code null} if no value is mapped
|
||||
* @see java.util.Map#get(java.lang.Object)
|
||||
* @see java.util.concurrent.Future
|
||||
*/
|
||||
Future<V> getLater(@NotNull K key);
|
||||
|
||||
/**
|
||||
* Associates the specified value with the specified key in this map (optional operation). If
|
||||
* the map previously contained a mapping for the key, the old value is replaced by the
|
||||
* specified value. (A map <tt>m</tt> is said to contain a mapping for a key <tt>k</tt> if and
|
||||
* only if {@link #containsKey(Object) m.containsKey(k)} would return <tt>true</tt>.)
|
||||
*
|
||||
* Calling this method may or may not block until the operating is complete depending on the
|
||||
* implementation.
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param value value to be associated with the specified key * @return a future containing the
|
||||
* previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no
|
||||
* mapping for <tt>key</tt>. (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>, if the implementation
|
||||
* supports <tt>null</tt> values.)
|
||||
* @return a future containing either, the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* @see java.util.Map#put(java.lang.Object, java.lang.Object)
|
||||
* @see java.util.concurrent.Future
|
||||
*/
|
||||
Future<V> putLater(@NotNull K key, @NotNull V value);
|
||||
|
||||
/**
|
||||
* Removes the mapping for a key from this map if it is present (optional operation). More
|
||||
* formally, if this map contains a mapping from key <tt>k</tt> to value <tt>v</tt> such that
|
||||
* <code>(key==null ? k==null : key.equals(k))</code>, that mapping is removed. (The map can
|
||||
* contain at most one such mapping.)
|
||||
*
|
||||
* <p>Returns a future containing, either the value to which this map previously associated the
|
||||
* key, or <tt>null</tt> if the map contained no mapping for the key.
|
||||
*
|
||||
* This method behaves the same as {@link java.util.Map#remove(java.lang.Object)} yet wraps
|
||||
* result in a future a {@link java.util.concurrent.Future}.
|
||||
*
|
||||
* Calling this method may or may not block until the operating is complete depending on the
|
||||
* implementation.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return a future containing either, the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* @see java.util.Map#remove(java.lang.Object)
|
||||
* @see java.util.concurrent.Future
|
||||
*/
|
||||
Future<V> removeLater(@NotNull K key);
|
||||
|
||||
/**
|
||||
* exports all the entries to a {@link java.io.File} storing them in JSON format, an attempt is
|
||||
* made where possible to use standard java serialisation and keep the data human readable, data
|
||||
|
||||
@@ -157,40 +157,6 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Future<V> getLater(@NotNull final K key) {
|
||||
return lazyExecutorService().submit(new Callable<V>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public V call() throws Exception {
|
||||
return StatelessChronicleMap.this.get(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Future<V> putLater(@NotNull final K key, @NotNull final V value) {
|
||||
return lazyExecutorService().submit(new Callable<V>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public V call() throws Exception {
|
||||
return StatelessChronicleMap.this.put(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> removeLater(@NotNull final K key) {
|
||||
return lazyExecutorService().submit(new Callable<V>() {
|
||||
@Override
|
||||
public V call() throws Exception {
|
||||
return StatelessChronicleMap.this.remove(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAll(File toFile) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -50,10 +50,7 @@ import java.lang.reflect.Array;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static java.lang.Class.forName;
|
||||
import static java.lang.Long.numberOfTrailingZeros;
|
||||
@@ -569,102 +566,6 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> getLater(@NotNull K key) {
|
||||
final V v = get(key);
|
||||
return new Future<V>() {
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get() throws InterruptedException, ExecutionException {
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(long timeout, @NotNull TimeUnit unit)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> putLater(@NotNull K key, @NotNull V value) {
|
||||
final V v = put(key, value);
|
||||
return new Future<V>() {
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get() throws InterruptedException, ExecutionException {
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(long timeout, TimeUnit unit)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> removeLater(@NotNull K key) {
|
||||
final V v = remove(key);
|
||||
return new Future<V>() {
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get() throws InterruptedException, ExecutionException {
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(long timeout, TimeUnit unit)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void getAll(File toFile) throws IOException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user