mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Allow ReplicatedChronicleMap to be accessed without configuring replicators
This commit is contained in:
@@ -1633,7 +1633,6 @@ public final class ChronicleMapBuilder<K, V> implements
|
||||
persisted = false;
|
||||
|
||||
try {
|
||||
// pushingToMapEventListener();
|
||||
VanillaChronicleMap<K, ?, ?, V, ?, ?, ?> map = newMap(singleHashReplication, channel);
|
||||
// TODO this method had been moved
|
||||
// if(OS.warnOnWindows(map.sizeInBytesWithoutTiers())){
|
||||
@@ -1737,12 +1736,17 @@ public final class ChronicleMapBuilder<K, V> implements
|
||||
replicators.add(Replicators.tcp(singleHashReplication));
|
||||
if (singleHashReplication.udpTransport() != null)
|
||||
replicators.add(Replicators.udp(singleHashReplication.udpTransport()));
|
||||
} else {
|
||||
} else if (channel != null) {
|
||||
ReplicationHub hub = channel.hub();
|
||||
|
||||
ChannelProvider provider = ChannelProvider.getProvider(hub);
|
||||
ChannelProvider.ChronicleChannel ch = provider.createChannel(channel.channelId());
|
||||
replicators.add(ch);
|
||||
} else {
|
||||
assert persisted && !((ReplicatedChronicleMap) map).createdOrInMemory :
|
||||
"No Replicators for replicated ChronicleMap could be only on " +
|
||||
"deserialization/access of existing replicated ChronicleMap, " +
|
||||
"when replication in not needed in this JVM/run";
|
||||
}
|
||||
for (Replicator replicator : replicators) {
|
||||
Closeable token = replicator.applyTo(this, result, result,
|
||||
|
||||
@@ -128,7 +128,6 @@ public class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? sup
|
||||
throws IOException {
|
||||
super(builder);
|
||||
this.timeProvider = builder.timeProvider();
|
||||
this.remoteOperations = (MapRemoteOperations<K, V, R>) builder.remoteOperations;
|
||||
|
||||
this.localIdentifier = replication.identifier();
|
||||
this.bootstrapOnlyLocalEntries = replication.bootstrapOnlyLocalEntries();
|
||||
@@ -177,6 +176,12 @@ public class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? sup
|
||||
tierBulkModIterFrameForIteration = new ConcurrentFlatBitSetFrame(tierBulkBitSetSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
void initTransientsFromBuilder(ChronicleMapBuilder<K, V> builder) {
|
||||
super.initTransientsFromBuilder(builder);
|
||||
this.remoteOperations = (MapRemoteOperations<K, V, R>) builder.remoteOperations;
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
initOwnTransients();
|
||||
|
||||
Reference in New Issue
Block a user