Standard code formatting

This commit is contained in:
Peter Lawrey
2018-04-21 10:49:49 +01:00
parent c7efd950f8
commit 9323cf28a7
270 changed files with 2801 additions and 2551 deletions
@@ -24,25 +24,28 @@ import net.openhft.chronicle.hash.serialization.SizedReader;
import net.openhft.chronicle.hash.serialization.SizedWriter;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
/**
* {@code ChronicleMap} provides concurrent access to a <i>Chronicle Map key-value store</i> from a
* JVM process.
*
* <p>
* <p>For information on <ul> <li>how to construct a {@code ChronicleMap}</li> <li>{@code
* ChronicleMap} flavors and properties</li> <li>available configurations</li> </ul> see {@link
* ChronicleMapBuilder} documentation.
*
* <p>
* <p>Functionally this interface defines some methods supporting garbage-free off-heap programming:
* {@link #getUsing(Object, Object)}, {@link #acquireUsing(Object, Object)}.
*
* <p>
* <p>Roughly speaking, {@code ChronicleMap} compares keys and values by their binary serialized
* form, that shouldn't necessary be the same equality relation as defined by built-in {@link
* Object#equals(Object)} method, which is prescribed by general {@link Map} contract.
*
* <p>
* <p>Note that {@code ChronicleMap} extends {@link Closeable}, don't forget to {@linkplain #close()
* close} map when it is no longer needed.
*
@@ -59,10 +62,10 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>,
/**
* Delegates to {@link ChronicleMapBuilder#of(Class, Class)} for convenience.
*
* @param keyClass class of the key type of the Chronicle Map to create
* @param keyClass class of the key type of the Chronicle Map to create
* @param valueClass class of the value type of the Chronicle Map to create
* @param <K> the key type of the Chronicle Map to create
* @param <V> the value type of the Chronicle Map to create
* @param <K> the key type of the Chronicle Map to create
* @param <V> the value type of the Chronicle Map to create
* @return a new {@code ChronicleMapBuilder} for the given key and value classes
*/
static <K, V> ChronicleMapBuilder<K, V> of(Class<K> keyClass, Class<V> valueClass) {
@@ -72,7 +75,7 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>,
/**
* Returns the value to which the specified key is mapped, or {@code null} if this map contains
* no mapping for the key.
*
* <p>
* <p>If the value class allows reusing, consider {@link #getUsing(Object, Object)} method
* instead of this to reduce garbage creation. Read <a
* href="https://github.com/OpenHFT/Chronicle-Map#single-key-queries">the section about usage
@@ -89,13 +92,13 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>,
/**
* Returns the value to which the specified key is mapped, read to the provided {@code value}
* object, if possible, or returns {@code null}, if this map contains no mapping for the key.
*
* <p>
* <p>If the specified key is present in the map, the value data is read to the provided {@code
* value} object via value reader's {@link SizedReader#read(net.openhft.chronicle.bytes.Bytes, long, Object)
* read(StreamingDataInput, size, value)} method. If the value deserializer is able to reuse the
* given {@code value} object, calling this method instead of {@link #get(Object)} could help to
* reduce garbage creation.
*
* <p>
* <p>The provided {@code value} object is allowed to be {@code null}, in this case {@code
* map.getUsing(key, null)} call is semantically equivalent to simple {@code map.get(key)}
* call.
@@ -112,17 +115,17 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>,
/**
* Acquire a value for a key, creating if absent.
*
* <p>
* <p>If the specified key is absent in the map, {@linkplain
* ChronicleMapBuilder#defaultValueProvider(DefaultValueProvider) default value provider} is
* called. Then this object is put to this map for the specified key.
*
* <p>
* <p>Then, either if the key was initially absent in the map or already present, the value is
* deserialized just as during {@link #getUsing(Object, Object) getUsing(key, usingValue)} call,
* passed the same {@code key} and {@code usingValue} as into this method call. This means, as
* in {@link #getUsing}, {@code usingValue} could safely be {@code null}, in this case a new
* value instance is created to deserialize the data.
*
* <p>
* <p>In code, {@code acquireUsing} is specified as :
* <pre>{@code
* V acquireUsing(K key, V usingValue) {
@@ -130,11 +133,11 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>,
* put(key, defaultValue(key));
* return getUsing(key, usingValue);
* }}</pre>
*
*
* <p>
* <p>
* <p>Where {@code defaultValue(key)} returns {@link
* ChronicleMapBuilder#defaultValueProvider(DefaultValueProvider) defaultValueProvider}.
*
* <p>
* <p>If the {@code ChronicleMap} is off-heap updatable, i. e. created via {@link
* ChronicleMapBuilder} builder (values are {@link Byteable}), there is one more option of what
* to do if the key is absent in the map. By default, value bytes are just zeroed out, no