diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index 6f3c4d73a..736fab825 100644 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -338,7 +338,7 @@ public final class ChronicleMapBuilder implements ChronicleMapBuilderI create() { return delegate.create(); } diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java index f121b6c7e..7a1f4e948 100644 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java @@ -247,7 +247,7 @@ interface ChronicleMapBuilderI { ChronicleMapBuilderI replication(SingleChronicleHashReplication withId); - ChronicleMap create() throws IOException; + ChronicleMap create(); ChronicleMapBuilderI actualSegments(int actualSegments); diff --git a/src/main/java/net/openhft/chronicle/java8/Function.java b/src/main/java/net/openhft/chronicle/map/Function.java similarity index 91% rename from src/main/java/net/openhft/chronicle/java8/Function.java rename to src/main/java/net/openhft/chronicle/map/Function.java index 3d680e259..a7f24600c 100644 --- a/src/main/java/net/openhft/chronicle/java8/Function.java +++ b/src/main/java/net/openhft/chronicle/map/Function.java @@ -1,4 +1,4 @@ -package net.openhft.chronicle.java8; +package net.openhft.chronicle.map; import java.io.Serializable; @@ -10,7 +10,6 @@ import java.io.Serializable; * * @param the type of the input to the function * @param the type of the result of the function - * @since 1.8 */ public interface Function extends Serializable { diff --git a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java index 485099233..803d4e292 100644 --- a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java @@ -29,7 +29,6 @@ import net.openhft.lang.model.Byteable; import org.jetbrains.annotations.NotNull; import java.io.Externalizable; -import java.io.IOException; import java.io.Serializable; @@ -39,7 +38,7 @@ import java.io.Serializable; * Long}, {@link Double}, etc.), {@link String}s and {@link CharSequence}s, values implementing {@link * BytesMarshallable}, {@link Externalizable} or {@link Serializable} interface, or any other values for which * {@linkplain #valueMarshaller(BytesMarshaller) custom marshaller} is provided. - * + *

*

Use static {@link #of(Class, Class) of(Key.class, Value.class)} method to obtain a {@code * ChronicleMapOnHeapUpdatableBuilder} instance. * @@ -56,7 +55,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * Returns a new {@code ChronicleMapOnHeapUpdatableBuilder} instance which is able to {@linkplain * #create() create} maps with the specified key and value classes. - * + *

*

{@code ChronicleMapOnHeapUpdatableBuilder} analyzes provided key and value classes and automatically * chooses the most specific and effective serializer which it is aware about. Read the section about serialization in @@ -82,10 +81,6 @@ final class OnHeapUpdatableChronicleMapBuilder return this; } - public ChronicleMap create() throws IOException { - return super.create(); - } - /** * {@inheritDoc} * @@ -113,10 +108,10 @@ final class OnHeapUpdatableChronicleMapBuilder * Configures the optimal number of bytes, taken by serialized form of values, put into maps, created by * this builder. If value size is always the same, call {@link #constantValueSizeBySample(Object)} method * instead of this one. - * + *

*

If value is a boxed primitive type, i. e. if value size is known statically, it is automatically * accounted and shouldn't be specified by user. - * + *

*

If value size varies moderately, specify the size higher than average, but lower than the maximum * possible, to minimize average memory overuse. If value size varies in a wide range, it's better to use * {@linkplain #entrySize(int) entry size} in "chunk" mode and configure it directly. @@ -136,10 +131,10 @@ final class OnHeapUpdatableChronicleMapBuilder * Configures the constant number of bytes, taken by serialized form of values, put into maps, created by * this builder. This is done by providing the {@code sampleValue}, all values should take the same number * of bytes in serialized form, as this sample object. - * + *

*

If values are of boxed primitive type or {@link Byteable} subclass, i. e. if value size is known * statically, it is automatically accounted and this method shouldn't be called. - * + *

*

If value size varies, method {@link #valueSize(int)} or {@link #entrySize(int)} should be called * instead of this one. * @@ -157,7 +152,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * {@inheritDoc} - * + *

*

Example:

{@code Map map =
      *     ChronicleMapBuilder.of(Key.class, Value.class)
      *     .entries(1_000_000)
@@ -165,7 +160,7 @@ final class OnHeapUpdatableChronicleMapBuilder
      *     // this class hasn't implemented yet, just for example
      *     .objectSerializer(new KryoObjectSerializer())
      *     .create();}
- * + *

*

This serializer is used to serialize both keys and values, if they both require this: loosely typed, * nullable, and custom {@linkplain #keyMarshaller(BytesMarshaller) key} and {@linkplain * #valueMarshaller(BytesMarshaller) value} marshallers are not configured. @@ -178,7 +173,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * {@inheritDoc} - * + *

*

If {@linkplain #valueMarshaller(BytesMarshaller) custom value marshaller} is configured, this * configuration is unused, because it is incapsulated in {@link BytesMarshaller#read(Bytes)} method * (without provided instance to read the data into), i. e. it's is the user-side responsibility. Actually @@ -197,7 +192,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * {@inheritDoc} - * + *

*

By default, the default value is set to {@code null}. * * @see #defaultValueProvider(DefaultValueProvider) @@ -209,7 +204,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * {@inheritDoc} - * + *

*

By default, default value provider is not specified, {@link #defaultValue(Object) default value} is * specified instead. * @@ -242,10 +237,10 @@ final class OnHeapUpdatableChronicleMapBuilder * Configures the marshallers, used to serialize/deserialize values to/from off-heap memory in maps, * created by this builder. See the * section about serialization in ChronicleMap manual for more information. - * + *

*

Configuring marshalling this way results to a little bit more compact in-memory layout of the map, * comparing to a single interface configuration: {@link #valueMarshaller(BytesMarshaller)}. - * + *

*

Passing {@link net.openhft.chronicle.hash.serialization.BytesInterop} instead of plain {@link * BytesWriter} is, of cause, possible, but currently pointless for values. * @@ -264,7 +259,7 @@ final class OnHeapUpdatableChronicleMapBuilder /** * Configures the marshaller used to serialize actual value sizes to off-heap memory in maps, created by * this builder. - * + *

*

Default value size marshaller is so-called {@linkplain net.openhft.chronicle.hash.serialization.SizeMarshallers#stopBit() * stop bit encoding marshalling}. If {@linkplain #constantValueSizeBySample(Object) constant value size} * is configured, or defaulted if the value type is always constant and {@code ChronicleHashBuilder} @@ -286,7 +281,7 @@ final class OnHeapUpdatableChronicleMapBuilder * Configures the procedure which is called on the bytes, which later the returned value is pointing to, * if the key is absent, on {@link ChronicleMap#acquireUsing(Object, Object) acquireUsing()} call on maps, * created by this builder. See {@link PrepareValueBytes} for more information. - * + *

*

The default preparation callback zeroes out the value bytes. * * @param prepareValueBytes what to do with the value bytes before assigning them into the {@link diff --git a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java index 1c1303cac..f357c8da8 100644 --- a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java @@ -20,7 +20,6 @@ package net.openhft.chronicle.map; import com.sun.jdi.connect.spi.ClosedConnectionException; import net.openhft.chronicle.hash.RemoteCallTimeoutException; -import net.openhft.chronicle.java8.Function; import net.openhft.lang.io.ByteBufferBytes; import net.openhft.lang.io.Bytes; import net.openhft.lang.threadlocal.ThreadLocalCopies; @@ -473,7 +472,7 @@ class StatelessChronicleMap implements ChronicleMap, Closeable { private void writeObject(@NotNull Function function) { - long start = bytes.position(); + long start = bytes.position(); for (; ; ) { try { bytes.writeObject(function); diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java index 1b895a7c1..377cc6ba8 100644 --- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java @@ -21,7 +21,6 @@ package net.openhft.chronicle.map; import net.openhft.chronicle.hash.replication.RemoteNodeValidator; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import net.openhft.chronicle.hash.replication.ThrottlingConfig; -import net.openhft.chronicle.java8.Function; import net.openhft.lang.io.ByteBufferBytes; import net.openhft.lang.io.Bytes; import net.openhft.lang.threadlocal.ThreadLocalCopies; diff --git a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java index d2385a1cb..853c6cfbd 100644 --- a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java +++ b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java @@ -19,7 +19,6 @@ package net.openhft.chronicle.map; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; -import net.openhft.chronicle.java8.Function; import org.junit.Assert; import org.junit.Test; @@ -73,7 +72,6 @@ public class StatelessClientTest { } - @Test public void testMapForKeyWhenNoEntry() throws IOException, InterruptedException {