diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedReader.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedReader.java index 6dc11b5d9..c12f110d5 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedReader.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedReader.java @@ -26,17 +26,12 @@ import net.openhft.chronicle.wire.WireOut; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class CharSequenceSizedReader implements SizedReader, +public final class CharSequenceSizedReader implements SizedReader, StatefulCopyable, ReadResolvable { public static final CharSequenceSizedReader INSTANCE = new CharSequenceSizedReader(); - /** - * @deprecated use {@link #INSTANCE} as {@code CharSequenceSizedReader} is immutable and - * stateless - */ - @Deprecated(/* to be removed in x.22 */) - public CharSequenceSizedReader() { + private CharSequenceSizedReader() { } @NotNull diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedWriter.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedWriter.java deleted file mode 100644 index 614e31426..000000000 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedWriter.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012-2018 Chronicle Map Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.openhft.chronicle.hash.serialization.impl; - -import net.openhft.chronicle.bytes.AppendableUtil; -import net.openhft.chronicle.bytes.Bytes; -import net.openhft.chronicle.bytes.BytesUtil; -import net.openhft.chronicle.hash.serialization.SizedWriter; -import org.jetbrains.annotations.NotNull; - -/** - * @deprecated use one of {@link AbstractCharSequenceUtf8DataAccess} subclasses instead. This class - * is not removed, because users who created a chronicleMap with older version of the library with - * this class as the key or value writer should be able to read and access the map with the present - * version of the library. - */ -@Deprecated(/* to be removed in x.22 */) -@SuppressWarnings("deprecation") -public final class CharSequenceSizedWriter - implements SizedWriter, EnumMarshallable { - public static final CharSequenceSizedWriter INSTANCE = new CharSequenceSizedWriter(); - - private CharSequenceSizedWriter() { - } - - @Override - public long size(@NotNull CharSequence toWrite) { - return AppendableUtil.findUtf8Length(toWrite); - } - - @Override - public void write(@NotNull Bytes out, long size, @NotNull CharSequence toWrite) { - BytesUtil.appendUtf8(out, toWrite); - } - - @NotNull - @Override - public CharSequenceSizedWriter readResolve() { - return INSTANCE; - } -} diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/IntegerDataAccess.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/IntegerDataAccess.java deleted file mode 100644 index 24b37c2f7..000000000 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/IntegerDataAccess.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2012-2018 Chronicle Map Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.openhft.chronicle.hash.serialization.impl; - -import net.openhft.chronicle.algo.hashing.LongHashFunction; -import net.openhft.chronicle.bytes.BytesStore; -import net.openhft.chronicle.bytes.RandomDataInput; -import net.openhft.chronicle.bytes.RandomDataOutput; -import net.openhft.chronicle.hash.AbstractData; -import net.openhft.chronicle.hash.Data; -import net.openhft.chronicle.hash.serialization.DataAccess; -import net.openhft.chronicle.wire.WireIn; -import net.openhft.chronicle.wire.WireOut; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated use {@link IntegerDataAccess_3_13} instead. This class is not removed only because - * users who created a Chronicle Map with older version of the library with this class as the key or - * value data access should be able to read and access the map with the present version of the - * Chronicle Map library. - */ -@SuppressWarnings("DeprecatedIsStillUsed") -@Deprecated(/* to be removed in x.22 */) -public final class IntegerDataAccess extends AbstractData - implements DataAccess, Data { - - // Cache fields - private transient boolean bsInit; - private transient BytesStore bs; - - /** - * State field - */ - private transient Integer instance; - - public IntegerDataAccess() { - initTransients(); - } - - private void initTransients() { - bs = BytesStore.wrap(new byte[4]); - } - - @Override - public RandomDataInput bytes() { - if (!bsInit) { - bs.writeInt(0, instance); - bsInit = true; - } - return bs; - } - - @Override - public long offset() { - return 0; - } - - @Override - public long size() { - return 4; - } - - @Override - public Integer get() { - return instance; - } - - @Override - public Integer getUsing(@Nullable Integer using) { - return instance; - } - - @Override - public long hash(LongHashFunction f) { - if (f == LongHashFunction.xx_r39()) { - return WrongXxHash.hashInt(instance); - } else { - return f.hashInt(instance); - } - } - - @Override - public boolean equivalent(RandomDataInput source, long sourceOffset) { - return source.readInt(sourceOffset) == instance; - } - - @Override - public void writeTo(RandomDataOutput target, long targetOffset) { - target.writeInt(targetOffset, instance); - } - - @Override - public Data getData(@NotNull Integer instance) { - this.instance = instance; - bsInit = false; - return this; - } - - @Override - public void uninit() { - instance = null; - } - - @Override - public void readMarshallable(@NotNull WireIn wireIn) { - // no config fields to read - initTransients(); - } - - @Override - public void writeMarshallable(@NotNull WireOut wireOut) { - // no config fields to write - } - - @Override - @SuppressWarnings("deprecation") - public DataAccess copy() { - return new IntegerDataAccess(); - } -} diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/WrongXxHash.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/WrongXxHash.java deleted file mode 100644 index e2ab56f70..000000000 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/WrongXxHash.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012-2018 Chronicle Map Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.openhft.chronicle.hash.serialization.impl; - -/** - * @deprecated this class exists for compatibility with old versions of Chronicle Map, which used - * wrong version of xxHash. - */ -@Deprecated(/* to be removed in x.22 */) -public final class WrongXxHash { - - // xxHash constants - private static final long P1 = -7046029288634856825L; - private static final long P2 = -4417276706812531889L; - private static final long P3 = 1609587929392839161L; - private static final long P5 = 2870177450012600261L; - - private WrongXxHash() { - } - - public static long hashInt(int input) { - long hash = P5 + 4; - // Preserve old, wrong behaviour. In the correct version, input is widened to long as - // unsigned here. - hash ^= input * P1; - hash = Long.rotateLeft(hash, 23) * P2 + P3; - return finalize(hash); - } - - private static long finalize(long hash) { - hash ^= hash >>> 33; - hash *= P2; - hash ^= hash >>> 29; - hash *= P3; - hash ^= hash >>> 32; - return hash; - } -} diff --git a/src/main/java/net/openhft/chronicle/map/Replica.java b/src/main/java/net/openhft/chronicle/map/Replica.java index 18bb5947e..de62ada45 100644 --- a/src/main/java/net/openhft/chronicle/map/Replica.java +++ b/src/main/java/net/openhft/chronicle/map/Replica.java @@ -130,15 +130,6 @@ public interface Replica extends Closeable { */ boolean nextEntry(@NotNull final Callback callback, final int chronicleId); - /** - * Synchronous version which is kept for binary API compatibility. - * - * @deprecated see {@link #dirtyEntries(long, EventLoop)} - * @param fromTimeStamp the timestamp from which all entries should be dirty - */ - @Deprecated(/* to be removed in x.22 */) - void dirtyEntries(long fromTimeStamp); - /** * Dirties all entries with a modification time equal to {@code fromTimeStamp} or newer and * origin identifier equal to the current node identifier. It means all these entries will diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java index c04dd480b..86e63bdd8 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java @@ -1051,22 +1051,6 @@ public class ReplicatedChronicleMap extends VanillaChronicleMap true, fromTimeStamp); - - try { - for (int i = 0; i < actualSegments + 1; i++) // Call [actualSegments + 1] times to trigger context close - syncHandler.action(); - } catch (InvalidEventHandlerException e) { - if (e.getCause() instanceof ChronicleHashClosedException) - throw (ChronicleHashClosedException) e.getCause(); - } - } - @Override public void dirtyEntries(long fromTimeStamp, @NotNull EventLoop eventLoop) { throwExceptionIfClosed(); diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java deleted file mode 100644 index acd71fbf8..000000000 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2012-2018 Chronicle Map Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.openhft.chronicle.map; - -import com.google.common.io.Files; -import net.openhft.chronicle.set.Builder; -import org.junit.Test; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -public class ChronicleMap3_8FormatCompatibilityTest { - - @Test - public void testChronicleMap3_8FormatCompatibility() throws URISyntaxException, IOException { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL fileUrl = cl.getResource("chronicle-map-3-8-file.dat"); - File file = new File(fileUrl.toURI()); - File persistenceFile = Builder.getPersistenceFile(); - Files.copy(file, persistenceFile); - try (ChronicleMap map = ChronicleMap.of(Integer.class, String.class) - .averageValue("1") - .entries(1) - .createPersistedTo(persistenceFile)) { - assertEquals(1, map.size()); - assertEquals("1", map.get(1)); - assertNull(map.put(2, "2")); - assertEquals("2", map.remove(2)); - } - } -} diff --git a/src/test/resources/chronicle-map-3-8-file.dat b/src/test/resources/chronicle-map-3-8-file.dat deleted file mode 100644 index d83b092f6..000000000 Binary files a/src/test/resources/chronicle-map-3-8-file.dat and /dev/null differ