mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Remove deprecated methods and classes, work on #324
This commit is contained in:
@@ -54,3 +54,5 @@ local.properties
|
||||
*.cq4t
|
||||
*.cq4
|
||||
|
||||
|
||||
file.lock
|
||||
|
||||
@@ -820,9 +820,4 @@ public interface ChronicleHashBuilder<K, H extends ChronicleHash<K, ?, ?, ?>,
|
||||
*/
|
||||
B skipCloseOnExitHook(boolean skipCloseOnExitHook);
|
||||
|
||||
/**
|
||||
* @deprecated don't use private API in the client code
|
||||
*/
|
||||
@Deprecated(/* to be removed in x.22 */)
|
||||
Object privateAPI();
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public abstract class VanillaChronicleHash<K,
|
||||
createdOrInMemory = true;
|
||||
|
||||
@SuppressWarnings({"deprecation", "unchecked"})
|
||||
ChronicleHashBuilderPrivateAPI<K, ?> privateAPI = (ChronicleHashBuilderPrivateAPI<K, ?>) builder.privateAPI();
|
||||
final ChronicleHashBuilderPrivateAPI<K, ?> privateAPI = Jvm.getValue(builder, "privateAPI");
|
||||
|
||||
// Data model
|
||||
SerializationBuilder<K> keyBuilder = privateAPI.keyBuilder();
|
||||
|
||||
+1
-8
@@ -25,8 +25,6 @@ import net.openhft.chronicle.hash.impl.stage.entry.HashEntryStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.SegmentStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.CheckOnEachPublicOperation;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.KeyBytesInterop;
|
||||
import net.openhft.chronicle.hash.serialization.impl.IntegerDataAccess;
|
||||
import net.openhft.chronicle.hash.serialization.impl.WrongXxHash;
|
||||
import net.openhft.sg.Stage;
|
||||
import net.openhft.sg.StageRef;
|
||||
import net.openhft.sg.Staged;
|
||||
@@ -76,12 +74,7 @@ public class EntryKeyBytesData<K> extends AbstractData<K> {
|
||||
@Override
|
||||
public long hash(LongHashFunction f) {
|
||||
checkOnEachPublicOperation.checkOnEachPublicOperation();
|
||||
if (f == LongHashFunction.xx_r39() && entry.keySize == 4 &&
|
||||
hh.h().keyDataAccess instanceof IntegerDataAccess) {
|
||||
return WrongXxHash.hashInt(s.segmentBS.readInt(entry.keyOffset));
|
||||
} else {
|
||||
return super.hash(f);
|
||||
}
|
||||
return super.hash(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
package net.openhft.chronicle.hash.impl.stage.iter;
|
||||
|
||||
import net.openhft.chronicle.algo.hashing.LongHashFunction;
|
||||
import net.openhft.chronicle.core.OS;
|
||||
import net.openhft.chronicle.hash.impl.VanillaChronicleHashHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.HashEntryStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.KeyHashCode;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.SegmentStages;
|
||||
import net.openhft.chronicle.hash.serialization.impl.IntegerDataAccess;
|
||||
import net.openhft.chronicle.hash.serialization.impl.WrongXxHash;
|
||||
import net.openhft.sg.StageRef;
|
||||
import net.openhft.sg.Staged;
|
||||
|
||||
@@ -42,11 +39,7 @@ public class IterationKeyHashCode implements KeyHashCode {
|
||||
void initKeyHash() {
|
||||
long addr = s.tierBaseAddr + e.keyOffset;
|
||||
long len = e.keySize;
|
||||
if (len == 4 && hh.h().keyDataAccess instanceof IntegerDataAccess) {
|
||||
keyHash = WrongXxHash.hashInt(OS.memory().readInt(addr));
|
||||
} else {
|
||||
keyHash = LongHashFunction.xx_r39().hashMemory(addr, len);
|
||||
}
|
||||
keyHash = LongHashFunction.xx_r39().hashMemory(addr, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import net.openhft.chronicle.wire.WireIn;
|
||||
import net.openhft.chronicle.wire.WireOut;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -85,7 +84,7 @@ public class ByteBufferDataAccess extends AbstractData<ByteBuffer>
|
||||
@Override
|
||||
public Data<ByteBuffer> getData(@NotNull ByteBuffer instance) {
|
||||
bb = instance;
|
||||
if (instance instanceof DirectBuffer) {
|
||||
if (instance.isDirect()) {
|
||||
nativeBytesStore.init(instance, false);
|
||||
bytesStore = nativeBytesStore;
|
||||
} else {
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.openhft.chronicle.bytes.Bytes;
|
||||
import net.openhft.chronicle.bytes.BytesMarshallable;
|
||||
import net.openhft.chronicle.core.Jvm;
|
||||
import net.openhft.chronicle.core.OS;
|
||||
import net.openhft.chronicle.core.annotation.UsedViaReflection;
|
||||
import net.openhft.chronicle.hash.ChronicleHashBuilder;
|
||||
import net.openhft.chronicle.hash.ChronicleHashCorruption;
|
||||
import net.openhft.chronicle.hash.ChronicleHashRecoveryFailedException;
|
||||
@@ -187,8 +188,8 @@ public final class ChronicleMapBuilder<K, V> implements
|
||||
boolean skipCloseOnExitHook = false;
|
||||
private String name;
|
||||
// not final because of cloning
|
||||
private ChronicleMapBuilderPrivateAPI<K, V> privateAPI =
|
||||
new ChronicleMapBuilderPrivateAPI<>(this);
|
||||
@UsedViaReflection // Picked up via Jvm.getValue()
|
||||
private ChronicleMapBuilderPrivateAPI<K, V> privateAPI = new ChronicleMapBuilderPrivateAPI<>(this);
|
||||
// used when configuring the number of segments.
|
||||
private int minSegments = -1;
|
||||
private int actualSegments = -1;
|
||||
@@ -504,15 +505,6 @@ public final class ChronicleMapBuilder<K, V> implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated don't use private API in the client code
|
||||
*/
|
||||
@Override
|
||||
@Deprecated(/* to be removed in x.22 */)
|
||||
public Object privateAPI() {
|
||||
return privateAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <a href="#jvm-configurations">Read more about JVM-level configurations</a>.
|
||||
|
||||
@@ -25,8 +25,6 @@ import net.openhft.chronicle.hash.serialization.*;
|
||||
import net.openhft.chronicle.map.*;
|
||||
import net.openhft.chronicle.map.replication.MapRemoteOperations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -59,7 +57,7 @@ public final class ChronicleSetBuilder<K>
|
||||
//noinspection deprecation,unchecked
|
||||
privateAPI = new ChronicleSetBuilderPrivateAPI<>(
|
||||
(ChronicleHashBuilderPrivateAPI<K, MapRemoteOperations<K, DummyValue, ?>>)
|
||||
chronicleMapBuilder.privateAPI());
|
||||
Jvm.getValue(chronicleMapBuilder, "privateAPI"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,13 +356,5 @@ public final class ChronicleSetBuilder<K>
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated don't use private API in the client code
|
||||
*/
|
||||
@Deprecated(/* to be removed in x.22 */)
|
||||
@Override
|
||||
public Object privateAPI() {
|
||||
return privateAPI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -18,6 +18,7 @@ package net.openhft.chronicle.map;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import net.openhft.chronicle.set.Builder;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -25,6 +26,7 @@ import java.net.URL;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@Ignore("As per https://github.com/OpenHFT/Chronicle-Map/issues/324, there is no compatibility anymore")
|
||||
public class ChronicleMap3_12IntegerKeyCompatibilityTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -29,7 +29,7 @@ import static net.openhft.chronicle.map.Issue62ChronicleServer.prepare;
|
||||
public class Issue62ChronicleClient {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
prepare(MAP_FILE_B);
|
||||
/*prepare(MAP_FILE_B);
|
||||
|
||||
ChronicleMapBuilder<String, Long> cityPostalCodesMapBuilder =
|
||||
ChronicleMapBuilder.of(String.class, Long.class)
|
||||
@@ -49,6 +49,6 @@ public class Issue62ChronicleClient {
|
||||
for (Entry<String, Long> entry : map.entrySet()) {
|
||||
System.out.println(entry);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Issue62ChronicleServer {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
/*
|
||||
prepare(MAP_FILE_A);
|
||||
|
||||
ChronicleMapBuilder<String, Long> cityPostalCodesMapBuilder =
|
||||
@@ -64,6 +64,6 @@ public class Issue62ChronicleServer {
|
||||
|
||||
System.out.println("Map created");
|
||||
Jvm.pause(15000);
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.core.Jvm;
|
||||
import net.openhft.chronicle.core.values.LongValue;
|
||||
import net.openhft.chronicle.hash.ChecksumEntry;
|
||||
import net.openhft.chronicle.hash.ChronicleHashBuilderPrivateAPI;
|
||||
@@ -58,8 +59,7 @@ public class RecoverTest {
|
||||
.entries(2)
|
||||
.actualSegments(1)
|
||||
.checksumEntries(true);
|
||||
ChronicleHashBuilderPrivateAPI<?, ?> privateAPI =
|
||||
(ChronicleHashBuilderPrivateAPI<?, ?>) builder.privateAPI();
|
||||
final ChronicleHashBuilderPrivateAPI<?, ?> privateAPI = Jvm.getValue(builder, "privateAPI");
|
||||
privateAPI.replication((byte) 1);
|
||||
privateAPI.cleanupRemovedEntries(false);
|
||||
|
||||
@@ -110,8 +110,8 @@ public class RecoverTest {
|
||||
mapBB.putLong((int) offset, mapBB.getLong((int) offset) ^ (1L << bit));
|
||||
ChronicleMapBuilder<Integer, Integer> recoverBuilder = ChronicleMap
|
||||
.of(Integer.class, Integer.class);
|
||||
ChronicleHashBuilderPrivateAPI<?, ?> recoverPrivateAPI =
|
||||
(ChronicleHashBuilderPrivateAPI<?, ?>) recoverBuilder.privateAPI();
|
||||
final ChronicleHashBuilderPrivateAPI<?, ?> recoverPrivateAPI = Jvm.getValue(recoverBuilder, "privateAPI");
|
||||
|
||||
recoverPrivateAPI.replication((byte) 1);
|
||||
recoverPrivateAPI.cleanupRemovedEntries(false);
|
||||
try (ChronicleMap<Integer, Integer> recovered =
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.core.Jvm;
|
||||
import net.openhft.chronicle.hash.ChronicleHashBuilderPrivateAPI;
|
||||
import net.openhft.chronicle.map.jsr166.JSR166TestCase;
|
||||
import org.junit.Test;
|
||||
@@ -38,7 +39,9 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase {
|
||||
.of(Integer.class, CharSequence.class)
|
||||
.entries(1000)
|
||||
.averageValueSize(20);
|
||||
((ChronicleHashBuilderPrivateAPI<?, ?>) builder.privateAPI()).replication((byte) 1);
|
||||
|
||||
final ChronicleHashBuilderPrivateAPI<?, ?> privateAPI = Objects.requireNonNull(Jvm.getValue(builder,"privateAPI"));
|
||||
privateAPI.replication((byte) 1);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@@ -48,7 +51,8 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase {
|
||||
.entries(1000)
|
||||
.averageKeySize(20)
|
||||
.averageValueSize(20);
|
||||
((ChronicleHashBuilderPrivateAPI<?, ?>) builder.privateAPI()).replication((byte) 1);
|
||||
final ChronicleHashBuilderPrivateAPI<?, ?> privateAPI = Objects.requireNonNull(Jvm.getValue(builder,"privateAPI"));
|
||||
privateAPI.replication((byte) 1);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user