mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Update Chronicle Map to using bom 1.13.12
This commit is contained in:
+20
-18
@@ -26,7 +26,7 @@ import net.openhft.chronicle.values.ValueModel;
|
||||
import net.openhft.chronicle.values.Values;
|
||||
import net.openhft.chronicle.wire.Marshallable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.Externalizable;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -35,6 +35,20 @@ import static net.openhft.chronicle.hash.serialization.SizeMarshaller.stopBit;
|
||||
|
||||
public final class SerializationBuilder<T> implements Cloneable {
|
||||
|
||||
public final Class<T> tClass;
|
||||
public final boolean sizeIsStaticallyKnown;
|
||||
boolean serializesGeneratedClasses = false;
|
||||
private SizeMarshaller sizeMarshaller = stopBit();
|
||||
private SizedReader<T> reader;
|
||||
private DataAccess<T> dataAccess;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SerializationBuilder(Class<T> tClass) {
|
||||
this.tClass = tClass;
|
||||
configureByDefault(tClass);
|
||||
sizeIsStaticallyKnown = constantSizeMarshaller();
|
||||
}
|
||||
|
||||
private static boolean concreteClass(Class c) {
|
||||
return !c.isInterface() && !Modifier.isAbstract(c.getModifiers());
|
||||
}
|
||||
@@ -50,22 +64,6 @@ public final class SerializationBuilder<T> implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public final Class<T> tClass;
|
||||
private SizeMarshaller sizeMarshaller = stopBit();
|
||||
private SizedReader<T> reader;
|
||||
private DataAccess<T> dataAccess;
|
||||
|
||||
public final boolean sizeIsStaticallyKnown;
|
||||
|
||||
boolean serializesGeneratedClasses = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SerializationBuilder(Class<T> tClass) {
|
||||
this.tClass = tClass;
|
||||
configureByDefault(tClass);
|
||||
sizeIsStaticallyKnown = constantSizeMarshaller();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void configureByDefault(Class<T> tClass) {
|
||||
if (tClass.isPrimitive()) {
|
||||
@@ -98,7 +96,11 @@ public final class SerializationBuilder<T> implements Cloneable {
|
||||
if (concreteClass(tClass) && Byteable.class.isAssignableFrom(tClass)) {
|
||||
reader(new ByteableSizedReader<>((Class) tClass));
|
||||
dataAccess((DataAccess<T>) new ByteableDataAccess<>((Class) tClass));
|
||||
sizeMarshaller(constant(((Byteable) OS.memory().allocateInstance(tClass)).maxSize()));
|
||||
try {
|
||||
sizeMarshaller(constant(((Byteable) OS.memory().allocateInstance(tClass)).maxSize()));
|
||||
} catch (InstantiationException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
} else if (tClass == CharSequence.class) {
|
||||
reader((SizedReader<T>) CharSequenceSizedReader.INSTANCE);
|
||||
dataAccess((DataAccess<T>) new CharSequenceUtf8DataAccess());
|
||||
|
||||
@@ -23,11 +23,27 @@ import net.openhft.chronicle.core.OS;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public enum ZeroBytesStore implements BytesStore<ZeroBytesStore, Void> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public int peekUnsignedByte(long offset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readVolatileInt(long offset) throws BufferUnderflowException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectMemory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte readByte(long offset) {
|
||||
return 0;
|
||||
@@ -63,11 +79,6 @@ public enum ZeroBytesStore implements BytesStore<ZeroBytesStore, Void> {
|
||||
OS.memory().setMemory(address, size, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sharedMemory() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user