mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Merge remote-tracking branch 'origin/2.1' into 2.1
Conflicts: pom.xml
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>chronicle-map</artifactId>
|
||||
<version>2.1.18-SNAPSHOT</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<name>OpenHFT/Chronicle-Map</name>
|
||||
<description>Chronicle-Map</description>
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -1271,6 +1271,7 @@ public class ChronicleMapBuilder<K, V> implements Cloneable,
|
||||
VanillaChronicleMap<K, ?, ?, V, ?, ?> map =
|
||||
(VanillaChronicleMap<K, ?, ?, V, ?, ?>) m;
|
||||
map.headerSize = roundUpMapHeaderSize(fis.getChannel().position());
|
||||
map.initTransients(this);
|
||||
map.createMappedStoreAndSegments(file);
|
||||
// This is needed to property initialize key and value serialization builders,
|
||||
// which are later used in replication
|
||||
|
||||
@@ -144,8 +144,8 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
|
||||
}
|
||||
|
||||
@Override
|
||||
void initTransients() {
|
||||
super.initTransients();
|
||||
void initTransients(ChronicleMapBuilder<K, V> kvChronicleMapBuilder) {
|
||||
super.initTransients(kvChronicleMapBuilder);
|
||||
|
||||
closeables = new CopyOnWriteArraySet<Closeable>();
|
||||
}
|
||||
|
||||
@@ -88,19 +88,21 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
final int actualSegments;
|
||||
final long actualChunksPerSegment;
|
||||
final long entriesPerSegment;
|
||||
final MapEventListener<K, V> eventListener;
|
||||
final BytesMapEventListener bytesEventListener;
|
||||
// if set the ReturnsNull fields will cause some functions to return NULL
|
||||
// rather than as returning the Object can be expensive for something you probably don't use.
|
||||
final boolean putReturnsNull;
|
||||
final boolean removeReturnsNull;
|
||||
final Class nativeValueClass;
|
||||
final MultiMapFactory multiMapFactory;
|
||||
final int maxChunksPerEntry;
|
||||
private final long lockTimeOutNS;
|
||||
private final ChronicleHashErrorListener errorListener;
|
||||
private final int segmentHeaderSize;
|
||||
private final HashSplitting hashSplitting;
|
||||
|
||||
transient MapEventListener<K, V> eventListener;
|
||||
transient BytesMapEventListener bytesEventListener;
|
||||
// if set the ReturnsNull fields will cause some functions to return NULL
|
||||
// rather than as returning the Object can be expensive for something you probably don't use.
|
||||
transient boolean putReturnsNull;
|
||||
transient boolean removeReturnsNull;
|
||||
transient ChronicleHashErrorListener errorListener;
|
||||
|
||||
transient Provider<BytesReader<K>> keyReaderProvider;
|
||||
transient Provider<KI> keyInteropProvider;
|
||||
transient Provider<BytesReader<V>> valueReaderProvider;
|
||||
@@ -184,7 +186,6 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
greatestCommonDivisor((int) chunkSize, alignment) != alignment;
|
||||
this.specialEntrySpaceOffset = builder.specialEntrySpaceOffset(replicated);
|
||||
|
||||
this.errorListener = builder.errorListener();
|
||||
this.putReturnsNull = builder.putReturnsNull();
|
||||
this.removeReturnsNull = builder.removeReturnsNull();
|
||||
|
||||
@@ -193,13 +194,11 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
this.entriesPerSegment = builder.entriesPerSegment(replicated);
|
||||
this.multiMapFactory = builder.multiMapFactory(replicated);
|
||||
this.metaDataBytes = builder.metaDataBytes();
|
||||
this.eventListener = builder.eventListener();
|
||||
this.bytesEventListener = builder.bytesEventListener();
|
||||
this.segmentHeaderSize = builder.segmentHeaderSize(replicated);
|
||||
this.maxChunksPerEntry = builder.maxChunksPerEntry();
|
||||
|
||||
hashSplitting = HashSplitting.Splitting.forSegments(actualSegments);
|
||||
initTransients();
|
||||
initTransients(builder);
|
||||
}
|
||||
|
||||
static <T> T newInstance(Class<T> aClass, boolean isKey) {
|
||||
@@ -266,7 +265,15 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
return hashSplitting.segmentIndex(hash);
|
||||
}
|
||||
|
||||
void initTransients() {
|
||||
void initTransients(ChronicleMapBuilder<K, V> builder) {
|
||||
if (builder != null) {
|
||||
this.eventListener = builder.eventListener();
|
||||
this.errorListener = builder.errorListener();
|
||||
this.putReturnsNull = builder.putReturnsNull();
|
||||
this.removeReturnsNull = builder.removeReturnsNull();
|
||||
this.bytesEventListener = builder.bytesEventListener();
|
||||
}
|
||||
|
||||
keyReaderProvider = Provider.of((Class) originalKeyReader.getClass());
|
||||
keyInteropProvider = Provider.of((Class) originalKeyInterop.getClass());
|
||||
|
||||
@@ -353,7 +360,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
initTransients();
|
||||
initTransients(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user