diff --git a/pom.xml b/pom.xml
index f132c36e3..9a431f163 100755
--- a/pom.xml
+++ b/pom.xml
@@ -227,6 +227,7 @@
net/openhft/chronicle/hash/KeyContext.java
net/openhft/chronicle/map/MapKeyContext.java
net/openhft/chronicle/hash/locks/LockingStrategy.java
+ net/openhft/chronicle/map/TcpReplicator.java
-Xdoclint:none
diff --git a/src/main/java/net/openhft/chronicle/hash/ChronicleHash.java b/src/main/java/net/openhft/chronicle/hash/ChronicleHash.java
index ee419dd67..501800f5a 100644
--- a/src/main/java/net/openhft/chronicle/hash/ChronicleHash.java
+++ b/src/main/java/net/openhft/chronicle/hash/ChronicleHash.java
@@ -62,6 +62,8 @@ public interface ChronicleHash, EQC extends ExternalH
@NotNull
EQC queryContext(K key);
+
+ @NotNull EQC queryContext(Value key);
/**
* Checks the given predicate on each entry in this {@code ChronicleHash} until all entries
diff --git a/src/main/java/net/openhft/chronicle/hash/Value.java b/src/main/java/net/openhft/chronicle/hash/Value.java
index 5ebd1a4b7..172011bb6 100644
--- a/src/main/java/net/openhft/chronicle/hash/Value.java
+++ b/src/main/java/net/openhft/chronicle/hash/Value.java
@@ -72,8 +72,8 @@ public interface Value {
accessor.offset(source, index));
}
- default void writeTo(WriteAccess access, T2 handle, long offset) {
- Access.copy(access(), handle(), offset(), access, handle, offset, size());
+ default void writeTo(WriteAccess targetAccess, T2 target, long targetOffset) {
+ Access.copy(access(), handle(), offset(), targetAccess, target, targetOffset, size());
}
default void writeTo(StreamingDataOutput, ?, T2> output) {
@@ -83,8 +83,9 @@ public interface Value {
}
default > void writeTo(
- Accessor accessor, S source, long index) {
- writeTo(accessor.access(source), accessor.handle(source), accessor.offset(source, index));
+ Accessor targetAccessor, S target, long index) {
+ writeTo(targetAccessor.access(target), targetAccessor.handle(target),
+ targetAccessor.offset(target, index));
}
/**
diff --git a/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesAccessors.java b/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesAccessors.java
index a7fb65671..02a0a6aba 100644
--- a/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesAccessors.java
+++ b/src/main/java/net/openhft/chronicle/hash/impl/JavaLangBytesAccessors.java
@@ -28,7 +28,7 @@ import static net.openhft.chronicle.bytes.Access.nativeAccess;
public final class JavaLangBytesAccessors {
public static Accessor.Full uncheckedBytesAccessor(Bytes bytes) {
- return bytes instanceof NativeBytes ? NativeBytesAccessor.INSTANCE :
+ return bytes instanceof NativeBytes ? GenericBytesAccessor.INSTANCE :
GenericBytesAccessor.INSTANCE;
}
diff --git a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java
index bf0d07148..dd7e69f7c 100644
--- a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java
+++ b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java
@@ -548,7 +548,7 @@ public final class ChannelProvider implements Closeable {
@Override
protected Closeable applyTo(ChronicleMapBuilder builder,
Replica map, EntryExternalizable entryExternalizable,
- final ChronicleMap chronicleMap) {
+ final ReplicatedChronicleMap replicatedMap) {
add(chronicleChannel, map, entryExternalizable);
return this;
}
diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java
index 1696839de..c29e21864 100755
--- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java
+++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java
@@ -1473,7 +1473,8 @@ public final class ChronicleMapBuilder implements
replicators.add(ch);
}
for (Replicator replicator : replicators) {
- Closeable token = replicator.applyTo(this, result, result, map);
+ Closeable token = replicator.applyTo(this, result, result,
+ (ReplicatedChronicleMap)map);
if (replicators.size() == 1 && token.getClass() == UdpReplicator.class) {
LOG.warn(Replicators.ONLY_UDP_WARN_MESSAGE);
}
diff --git a/src/main/java/net/openhft/chronicle/map/FilePerKeyChronicleMap.java b/src/main/java/net/openhft/chronicle/map/FilePerKeyChronicleMap.java
index e00e91b24..a7b5bfed0 100644
--- a/src/main/java/net/openhft/chronicle/map/FilePerKeyChronicleMap.java
+++ b/src/main/java/net/openhft/chronicle/map/FilePerKeyChronicleMap.java
@@ -1,5 +1,6 @@
package net.openhft.chronicle.map;
+import net.openhft.chronicle.hash.Value;
import net.openhft.chronicle.hash.function.SerializableFunction;
import net.openhft.lang.Jvm;
import org.jetbrains.annotations.NotNull;
@@ -185,6 +186,12 @@ public class FilePerKeyChronicleMap implements ChronicleMap {
throw new UnsupportedOperationException();
}
+ @NotNull
+ @Override
+ public ExternalMapQueryContext queryContext(Value key) {
+ throw new UnsupportedOperationException();
+ }
+
@Override
public boolean forEachEntryWhile(Predicate super MapKeyContext> predicate) {
throw new UnsupportedOperationException();
diff --git a/src/main/java/net/openhft/chronicle/map/MapEntryOperations.java b/src/main/java/net/openhft/chronicle/map/MapEntryOperations.java
index 956590c34..d59a05e26 100644
--- a/src/main/java/net/openhft/chronicle/map/MapEntryOperations.java
+++ b/src/main/java/net/openhft/chronicle/map/MapEntryOperations.java
@@ -23,7 +23,10 @@ import org.jetbrains.annotations.NotNull;
/**
* SPI interface for customizing "low-level" modification operations on {@link ChronicleMap}
- * entries.
+ * entries. All {@code ChronicleMap} modifications operate via and instance of this interface:
+ *
+ * - Ordinary query operations: {@code map.put()}, {@code map.compute()}. In fact, the
+ *
*
* @param the map key type
* @param the map value type
diff --git a/src/main/java/net/openhft/chronicle/map/Replica.java b/src/main/java/net/openhft/chronicle/map/Replica.java
index 26e64f988..a4edf51dc 100644
--- a/src/main/java/net/openhft/chronicle/map/Replica.java
+++ b/src/main/java/net/openhft/chronicle/map/Replica.java
@@ -172,33 +172,6 @@ public interface Replica extends Closeable {
}
- /**
- * provides a key and value from NativeBytes, this can be used in conjunction with the
- * modification iterator to get the key and value out of the NativeBytes
- */
- interface EntryResolver {
-
- /**
- * gets the key from the entry
- *
- * @param entry the bytes which the bytes which point to the entry
- * @param usingKey the key object to reuse, if possible
- * @return the key which is in the entry
- */
- K key(@NotNull Bytes entry, K usingKey);
-
- /**
- * gets the value from the entry
- *
- * @param entry the bytes which reference to the entry
- * @param usingValue the value object to reuse, if possible
- * @return the value which is in the entry or null if the value has been remove from the map
- */
- V value(@NotNull Bytes entry, V usingValue);
-
- boolean wasRemoved(@NotNull Bytes entry);
- }
-
/**
* Implemented typically by a replicator, This interface provides the event, which will get
* called whenever a put() or remove() has occurred to the map
diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java
index 262fe3495..62e3992fa 100644
--- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java
+++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java
@@ -87,7 +87,7 @@ import static net.openhft.lang.collection.DirectBitSet.NOT_FOUND;
public class ReplicatedChronicleMap,
V, VI, MVI extends MetaBytesInterop, R>
extends VanillaChronicleMap
- implements Replica, Replica.EntryExternalizable, Replica.EntryResolver {
+ implements Replica, Replica.EntryExternalizable {
// for file, jdbc and UDP replication
public static final int RESERVED_MOD_ITER = 8;
public static final int ADDITIONAL_ENTRY_BYTES = 10;
@@ -108,6 +108,7 @@ public class ReplicatedChronicleMap remoteOperations =
DefaultSpi.mapRemoteOperations();
transient CompiledReplicatedMapQueryContext remoteOpContext;
+ transient CompiledReplicatedMapIterationContext remoteItContext;
public ReplicatedChronicleMap(@NotNull ChronicleMapBuilder builder,
AbstractReplication replication)
@@ -291,10 +292,12 @@ public class ReplicatedChronicleMap entry, int chronicleId) {
return entry.originIdentifier() == localIdentifier;
}
+ @Override
public int sizeOfEntry(@NotNull Bytes entry, int chronicleId) {
long start = entry.position();
@@ -413,12 +416,28 @@ public class ReplicatedChronicleMap remoteOpContext() {
if (remoteOpContext == null) {
- remoteOpContext = q().getContext();
+ remoteOpContext = q();
}
+ assert !remoteOpContext.usedInit();
+ remoteOpContext.initUsed(true);
return remoteOpContext;
}
+
+ private CompiledReplicatedMapIterationContext remoteItContext() {
+ if (remoteItContext == null) {
+ remoteItContext = i();
+ }
+ assert !remoteItContext.usedInit();
+ remoteItContext.initUsed(true);
+ return remoteItContext;
+ }
+
/**
* This method does not set a segment lock, A segment lock should be obtained before calling
* this method, especially when being used in a multi threaded context.
@@ -426,64 +445,9 @@ public class ReplicatedChronicleMap remoteOpContext =
- remoteOpContext()) {
- if (remoteOpContext.usedInit())
- throw new IllegalStateException();
- remoteOpContext.initUsed(true);
+ mapContext()) {
remoteOpContext.initReplicationInput(source);
- }
- }
-
- @Override
- public K key(@NotNull Bytes entry, K usingKey) {
- final long start = entry.position();
- try {
- long keySize = keySizeMarshaller.readSize(entry);
- ThreadLocalCopies copies = keyReaderProvider.getCopies(null);
- return keyReaderProvider.get(copies, originalKeyReader).read(entry, keySize);
- } finally {
- entry.position(start);
- }
- }
-
- @Override
- public V value(@NotNull Bytes entry, V usingValue) {
- final long start = entry.position();
- try {
- entry.skip(keySizeMarshaller.readSize(entry));
-
- //timeStamp
- entry.readLong();
-
- final byte identifier = entry.readByte();
- if (identifier != localIdentifier) {
- return null;
- }
-
- final boolean isDeleted = entry.readBoolean();
- long valueSize;
- if (!isDeleted) {
- valueSize = valueSizeMarshaller.readSize(entry);
- assert valueSize > 0;
- } else {
- return null;
- }
- alignment.alignPositionAddr(entry);
- ThreadLocalCopies copies = valueReaderProvider.getCopies(null);
- BytesReader valueReader = valueReaderProvider.get(copies, originalValueReader);
- return valueReader.read(entry, valueSize, usingValue);
- } finally {
- entry.position(start);
- }
- }
-
- @Override
- public boolean wasRemoved(@NotNull Bytes entry) {
- final long start = entry.position();
- try {
- return entry.readBoolean(keySizeMarshaller.readSize(entry) + 9L);
- } finally {
- entry.position(start);
+ remoteOpContext.processReplicatedEvent();
}
}
@@ -520,8 +484,6 @@ public class ReplicatedChronicleMap context =
- mapContext();
// records the current position of the cursor in the bitset
private volatile long position = -1L;
@@ -597,10 +559,10 @@ public class ReplicatedChronicleMap>> segmentIndexShift);
- if (context.theSegmentIndexInit() && context.segmentIndex() != segmentIndex)
+ try (CompiledReplicatedMapIterationContext context =
+ iterationContext()) {
context.initTheSegmentIndex(segmentIndex);
- context.updateLock().lock();
- try {
+ context.updateLock().lock();
if (changesForUpdates.get(position)) {
entryCallback.onBeforeEntry();
@@ -609,7 +571,7 @@ public class ReplicatedChronicleMapThis method isn't intended to be called from the client
* code.
*
+ * @param chronicleMap to wrap.
* @param builder the builder from which the map was constructed. The replicator may
* obtain some map configurations, not accessible via the map
* instance.
* @param map a replicated map instance. Provides basic tools for replication
* implementation.
* @param entryExternalizable the callback for ser/deser implementation in the replicator
- * @param chronicleMap to wrap.
+ * @param replicatedMap
* @return a {@code Closeable} token to control replication resources. It should be closed on
* closing the replicated map.
* @throws java.io.IOException if an io error occurred during the replicator setup
@@ -49,5 +50,5 @@ abstract class Replicator {
*/
protected abstract Closeable applyTo(ChronicleMapBuilder builder,
Replica map, Replica.EntryExternalizable entryExternalizable,
- final ChronicleMap chronicleMap) throws IOException;
+ final ReplicatedChronicleMap replicatedMap) throws IOException;
}
diff --git a/src/main/java/net/openhft/chronicle/map/Replicators.java b/src/main/java/net/openhft/chronicle/map/Replicators.java
index d72209de9..fcccf1e6d 100644
--- a/src/main/java/net/openhft/chronicle/map/Replicators.java
+++ b/src/main/java/net/openhft/chronicle/map/Replicators.java
@@ -114,13 +114,13 @@ final class Replicators {
protected Closeable applyTo(@NotNull final ChronicleMapBuilder builder,
@NotNull final Replica replica,
@NotNull final Replica.EntryExternalizable entryExternalizable,
- final ChronicleMap chronicleMap) throws IOException {
+ final ReplicatedChronicleMap replicatedMap) throws IOException {
TcpTransportAndNetworkConfig tcpConfig = replication.tcpTransportAndNetwork();
TcpReplicator.StatelessClientParameters statelessClientParameters =
new TcpReplicator.StatelessClientParameters(
- (VanillaChronicleMap) chronicleMap,
+ replicatedMap,
builder.keyBuilder,
builder.valueBuilder);
@@ -139,7 +139,7 @@ final class Replicators {
protected Closeable applyTo(@NotNull final ChronicleMapBuilder builder,
@NotNull final Replica map,
@NotNull final Replica.EntryExternalizable entryExternalizable,
- final ChronicleMap chronicleMap)
+ final ReplicatedChronicleMap replicatedMap)
throws IOException {
return new UdpReplicator(map, entryExternalizable, replicationConfig
);
diff --git a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java
index 885daeeec..43b946c90 100644
--- a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java
+++ b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java
@@ -20,6 +20,7 @@ package net.openhft.chronicle.map;
import net.openhft.chronicle.bytes.IORuntimeException;
import net.openhft.chronicle.core.util.CloseablesManager;
+import net.openhft.chronicle.hash.Value;
import net.openhft.chronicle.hash.function.SerializableFunction;
import net.openhft.chronicle.hash.impl.util.BuildVersion;
import net.openhft.chronicle.hash.serialization.BytesReader;
@@ -552,6 +553,12 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon
throw new UnsupportedOperationException("Contexts are not supported by stateless clients");
}
+ @NotNull
+ @Override
+ public ExternalMapQueryContext queryContext(Value key) {
+ throw new UnsupportedOperationException("Contexts are not supported by stateless clients");
+ }
+
public V get(Object key) {
return fetchObject(vClass, GET, (K) key);
}
diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java
index 175023f97..9f124b7bd 100644
--- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java
+++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java
@@ -24,8 +24,11 @@ import net.openhft.chronicle.hash.replication.RemoteNodeValidator;
import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
import net.openhft.chronicle.hash.replication.ThrottlingConfig;
import net.openhft.chronicle.hash.serialization.BytesReader;
+import net.openhft.chronicle.hash.serialization.internal.MetaBytesInterop;
import net.openhft.chronicle.hash.serialization.internal.ReaderWithSize;
import net.openhft.chronicle.hash.serialization.internal.SerializationBuilder;
+import net.openhft.chronicle.map.impl.CompiledReplicatedMapQueryContext;
+import net.openhft.chronicle.map.impl.QueryContextInterface;
import net.openhft.lang.io.AbstractBytes;
import net.openhft.lang.io.ByteBufferBytes;
import net.openhft.lang.io.Bytes;
@@ -68,7 +71,7 @@ interface Work {
*
* @author Rob Austin.
*/
-final class TcpReplicator extends AbstractChannelReplicator implements Closeable {
+public final class TcpReplicator extends AbstractChannelReplicator implements Closeable {
public static final long TIMESTAMP_FACTOR = 10000;
private static final int STATELESS_CLIENT = -127;
@@ -106,7 +109,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
StatelessClientParameters statelessClientParameters;
static class StatelessClientParameters {
- public StatelessClientParameters(VanillaChronicleMap map,
+ public StatelessClientParameters(ReplicatedChronicleMap map,
SerializationBuilder keySerializationBuilder,
SerializationBuilder valueSerializationBuilder) {
this.map = map;
@@ -114,7 +117,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
this.valueSerializationBuilder = valueSerializationBuilder;
}
- VanillaChronicleMap map;
+ ReplicatedChronicleMap map;
SerializationBuilder keySerializationBuilder;
SerializationBuilder valueSerializationBuilder;
}
@@ -1052,7 +1055,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
/**
* @author Rob Austin.
*/
- class TcpSocketChannelEntryWriter {
+ public class TcpSocketChannelEntryWriter {
@NotNull
@@ -1092,7 +1095,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
in().writeByte(localIdentifier);
}
- void ensureBufferSize(long size) {
+ public void ensureBufferSize(long size) {
if (in().remaining() < size) {
size += entryCallback.in().position();
if (size > Integer.MAX_VALUE)
@@ -1118,7 +1121,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
throw e;
}
- Bytes in() {
+ public Bytes in() {
return entryCallback.in();
}
@@ -1229,7 +1232,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
* localHeartbeatInterval
*/
private void writeHeartbeatToBuffer() {
- // denotes the state - 0 for a beat
+ // denotes the state - 0 for a heartbeat
in().writeByte(HEARTBEAT.ordinal());
// denotes the size in bytes
@@ -1471,7 +1474,7 @@ final class TcpReplicator extends AbstractChannelReplicator implements Clo
/**
* @author Rob Austin.
*/
-class StatelessServerConnector {
+class StatelessServerConnector {
private static final Logger LOG = LoggerFactory.getLogger(StatelessServerConnector.class
.getName());
@@ -1494,15 +1497,14 @@ class StatelessServerConnector {
private final WriterWithSize valueWriterWithSize;
@NotNull
- private final VanillaChronicleMap map;
- //private final BytesChronicleMap bytesMap;
+ private final ReplicatedChronicleMap map;
private final SerializationBuilder keySerializationBuilder;
private final SerializationBuilder valueSerializationBuilder;
private final int tcpBufferSize;
StatelessServerConnector(
- @NotNull VanillaChronicleMap map,
+ @NotNull ReplicatedChronicleMap map,
@NotNull final BufferResizer bufferResizer, int tcpBufferSize,
final SerializationBuilder keySerializationBuilder,
final SerializationBuilder valueSerializationBuilder) {
@@ -1515,7 +1517,6 @@ class StatelessServerConnector {
valueReaderWithSize = new ReaderWithSize<>(valueSerializationBuilder);
valueWriterWithSize = new WriterWithSize<>(valueSerializationBuilder, bufferResizer);
this.map = map;
- //bytesMap = new BytesChronicleMap(map);
}
@Nullable
@@ -1699,13 +1700,22 @@ class StatelessServerConnector {
return null;
}
+ private CompiledReplicatedMapQueryContext query(Bytes reader) {
+ CompiledReplicatedMapQueryContext q = map.mapContext();
+ q.initInputBytes(reader);
+ q.initInputKey(q.inputKeyBytesValue());
+ return q;
+ }
+
@Nullable
private Work removeWithValue(Bytes reader,
@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation, long timestamp, byte id) {
try {
writer.ensureBufferSize(1L);
- //writer.in().writeBoolean(bytesMap.remove(reader, reader));
+ try (CompiledReplicatedMapQueryContext q = query(reader)) {
+ writer.in().writeBoolean(map.methods.remove(q, q.inputFirstValueBytesValue()));
+ }
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1719,7 +1729,10 @@ class StatelessServerConnector {
final long sizeLocation, long timestamp, byte id) {
try {
writer.ensureBufferSize(1L);
- //writer.in().writeBoolean(bytesMap.replace(reader, reader, reader));
+ try (CompiledReplicatedMapQueryContext q = query(reader)) {
+ writer.in().writeBoolean(map.methods.replace(q, q.inputFirstValueBytesValue(),
+ q.inputSecondValueBytesValue()));
+ }
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1849,7 +1862,10 @@ class StatelessServerConnector {
@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation) {
try {
- //writer.in().writeBoolean(bytesMap.containsKey(reader));
+ writer.ensureBufferSize(1L);
+ try (CompiledReplicatedMapQueryContext q = query(reader)) {
+ writer.in().writeBoolean(map.methods.containsKey(q));
+ }
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1901,7 +1917,7 @@ class StatelessServerConnector {
final long sizeLocation, long timestamp, byte id) {
//bytesMap.output = writer;
try {
- // bytesMap.put(reader, reader);
+ //bytesMap.put(reader, reader);
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
} finally {
@@ -1914,20 +1930,20 @@ class StatelessServerConnector {
@SuppressWarnings("SameReturnValue")
@Nullable
private Work remove(Bytes reader, long timestamp, byte id) {
- //bytesMap.remove(reader);
+// bytesMap.remove(reader);
return null;
}
@Nullable
private Work remove(Bytes reader, TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation, long timestamp, byte id) {
- //bytesMap.output = writer;
+// bytesMap.output = writer;
try {
- // bytesMap.remove(reader);
+// bytesMap.remove(reader);
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
} finally {
- // bytesMap.output = null;
+// bytesMap.output = null;
}
writeSizeAndFlags(sizeLocation, false, writer.in());
return null;
@@ -1939,7 +1955,7 @@ class StatelessServerConnector {
final long sizeLocation,
long timestamp, byte id) {
try {
- // bytesMap.putAll(reader);
+// bytesMap.putAll(reader);
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
}
@@ -1950,7 +1966,7 @@ class StatelessServerConnector {
@SuppressWarnings("SameReturnValue")
@Nullable
private Work putAll(@NotNull Bytes reader, long timestamp, byte id) {
- //bytesMap.putAll(reader);
+// bytesMap.putAll(reader);
return null;
}
@@ -2110,11 +2126,11 @@ class StatelessServerConnector {
final long sizeLocation, long timestamp, byte id) {
// bytesMap.output = writer;
try {
- // bytesMap.putIfAbsent(reader, reader);
+// bytesMap.putIfAbsent(reader, reader);
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
} finally {
- // bytesMap.output = null;
+// bytesMap.output = null;
}
writeSizeAndFlags(sizeLocation, false, writer.in());
return null;
@@ -2123,13 +2139,13 @@ class StatelessServerConnector {
@Nullable
private Work replace(Bytes reader, TcpReplicator.TcpSocketChannelEntryWriter writer,
final long sizeLocation, long timestamp, byte id) {
- // bytesMap.output = writer;
+// bytesMap.output = writer;
try {
- // bytesMap.replace(reader, reader);
+// bytesMap.replace(reader, reader);
} catch (Throwable e) {
return sendException(writer, sizeLocation, e);
} finally {
- // bytesMap.output = null;
+// bytesMap.output = null;
}
writeSizeAndFlags(sizeLocation, false, writer.in());
return null;
diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
index 17293ab4a..cea0dcfc1 100755
--- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
+++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
@@ -19,6 +19,7 @@
package net.openhft.chronicle.map;
import net.openhft.chronicle.hash.KeyContext;
+import net.openhft.chronicle.hash.Value;
import net.openhft.chronicle.hash.impl.VanillaChronicleHash;
import net.openhft.chronicle.hash.serialization.BytesReader;
import net.openhft.chronicle.hash.serialization.SizeMarshaller;
@@ -364,6 +365,14 @@ public class VanillaChronicleMap queryContext(Value key) {
+ QueryContextInterface q = mapContext();
+ q.initInputKey(key);
+ return q;
+ }
+
@Override
public V get(Object key) {
try (QueryContextInterface q = queryContext(key)) {
diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java
index 4383df885..7f290c4dc 100644
--- a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java
+++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java
@@ -56,21 +56,21 @@ import java.util.concurrent.TimeUnit;
public class CompiledMapQueryContext, V, VI, MVI extends MetaBytesInterop, R, T> implements AutoCloseable , HashEntry , InterProcessReadWriteUpdateLock , ExternalMapQueryContext , MapAbsentEntry , MapContext , MapEntry , QueryContextInterface , VanillaChronicleMapHolder {
public void close() {
- CompiledMapQueryContext.this.defaultReturnValue.closeDefaultReturnedValue();
- CompiledMapQueryContext.this.closeAllocatedChunks();
CompiledMapQueryContext.this.closeInputKey();
CompiledMapQueryContext.this.wrappedValueInstanceValue.closeValue();
- CompiledMapQueryContext.this.usingReturnValue.closeUsingReturnValue();
- CompiledMapQueryContext.this.wrappedValueInstanceValue.closeNext();
- CompiledMapQueryContext.this.closeInputBytes();
CompiledMapQueryContext.this.closeUsed();
- CompiledMapQueryContext.this.inputKeyInstanceValue.closeKey();
+ CompiledMapQueryContext.this.closeInputBytes();
CompiledMapQueryContext.this.inputValueInstanceValue.closeValue();
- CompiledMapQueryContext.this.closeValueBytesInteropValueMetaInteropDependants();
- CompiledMapQueryContext.this.closeVanillaChronicleMapHolderImplContextAtIndexInChainDependants();
- CompiledMapQueryContext.this.closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants();
+ CompiledMapQueryContext.this.usingReturnValue.closeUsingReturnValue();
+ CompiledMapQueryContext.this.defaultReturnValue.closeDefaultReturnedValue();
+ CompiledMapQueryContext.this.closeAllocatedChunks();
+ CompiledMapQueryContext.this.wrappedValueInstanceValue.closeNext();
+ CompiledMapQueryContext.this.inputKeyInstanceValue.closeKey();
CompiledMapQueryContext.this.closeKeyBytesInteropKeyMetaInteropDependants();
+ CompiledMapQueryContext.this.closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants();
CompiledMapQueryContext.this.closeMapEntryStagesEntryBytesAccessOffsetDependants();
+ CompiledMapQueryContext.this.closeVanillaChronicleMapHolderImplContextAtIndexInChainDependants();
+ CompiledMapQueryContext.this.closeValueBytesInteropValueMetaInteropDependants();
}
public void incrementModCountGuarded() {
@@ -122,31 +122,31 @@ public class CompiledMapQueryContext)(entryBytesAccessor.access(entryBytes)));
this.deprecatedMapKeyContext = new DeprecatedMapKeyContextOnQuery();
- this.inputKeyBytesValue = new InputKeyBytesValue();
- this.innerUpdateLock = new UpdateLock();
- this.inputKeyInstanceValue = new InputKeyInstanceValue();
+ this.entryValue = new EntryValueBytesValue();
+ this.owner = Thread.currentThread();
+ this.defaultReturnValue = new DefaultReturnValue();
+ this.deprecatedMapAcquireContext = new DeprecatedMapAcquireContextOnQuery();
this.copies = ThreadLocalCopies.get();
this.valueInterop = CompiledMapQueryContext.this.m().valueInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.m().originalValueInterop);
this.valueReader = CompiledMapQueryContext.this.m().valueReaderProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.m().originalValueReader);
this.keyInterop = CompiledMapQueryContext.this.h().keyInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.h().originalKeyInterop);
this.keyReader = CompiledMapQueryContext.this.h().keyReaderProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.h().originalKeyReader);
- this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
- this.innerWriteLock = new WriteLock();
- this.owner = Thread.currentThread();
- this.usingReturnValue = new UsingReturnValue();
- this.deprecatedMapAcquireContext = new DeprecatedMapAcquireContextOnQuery();
- this.entryValue = new EntryValueBytesValue();
- this.innerReadLock = new ReadLock();
- this.inputSecondValueBytesValue = new InputSecondValueBytesValue();
- this.defaultReturnValue = new DefaultReturnValue();
+ this.inputKeyInstanceValue = new InputKeyInstanceValue();
+ this.inputKeyBytesValue = new InputKeyBytesValue();
this.inputValueInstanceValue = new InputValueInstanceValue();
- this.entryBytes = CompiledMapQueryContext.this.h().ms.bytes();
- this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
- this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
- this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
+ this.innerWriteLock = new WriteLock();
this.entryKey = new EntryKeyBytesValue();
- this.inputFirstValueBytesValue = new InputFirstValueBytesValue();
+ this.usingReturnValue = new UsingReturnValue();
+ this.innerUpdateLock = new UpdateLock();
}
public CompiledMapQueryContext(CompiledMapQueryContext c) {
@@ -154,37 +154,41 @@ public class CompiledMapQueryContext)(c.m));
+ this.inputFirstValueBytesValue = new InputFirstValueBytesValue();
+ this.innerReadLock = new ReadLock();
+ this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
+ this.inputSecondValueBytesValue = new InputSecondValueBytesValue();
+ this.entryBytes = CompiledMapQueryContext.this.h().ms.bytes();
+ this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
+ this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
+ this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
this.deprecatedMapKeyContext = new DeprecatedMapKeyContextOnQuery();
- this.inputKeyBytesValue = new InputKeyBytesValue();
- this.innerUpdateLock = new UpdateLock();
- this.inputKeyInstanceValue = new InputKeyInstanceValue();
+ this.entryValue = new EntryValueBytesValue();
+ this.owner = Thread.currentThread();
+ this.defaultReturnValue = new DefaultReturnValue();
+ this.deprecatedMapAcquireContext = new DeprecatedMapAcquireContextOnQuery();
this.copies = ThreadLocalCopies.get();
this.valueInterop = CompiledMapQueryContext.this.m().valueInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.m().originalValueInterop);
this.valueReader = CompiledMapQueryContext.this.m().valueReaderProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.m().originalValueReader);
this.keyInterop = CompiledMapQueryContext.this.h().keyInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.h().originalKeyInterop);
this.keyReader = CompiledMapQueryContext.this.h().keyReaderProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.h().originalKeyReader);
- this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
- this.innerWriteLock = new WriteLock();
- this.owner = Thread.currentThread();
- this.usingReturnValue = new UsingReturnValue();
- this.deprecatedMapAcquireContext = new DeprecatedMapAcquireContextOnQuery();
- this.entryValue = new EntryValueBytesValue();
- this.innerReadLock = new ReadLock();
- this.inputSecondValueBytesValue = new InputSecondValueBytesValue();
- this.defaultReturnValue = new DefaultReturnValue();
+ this.inputKeyInstanceValue = new InputKeyInstanceValue();
+ this.inputKeyBytesValue = new InputKeyBytesValue();
this.inputValueInstanceValue = new InputValueInstanceValue();
- this.entryBytes = CompiledMapQueryContext.this.h().ms.bytes();
- this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
- this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
- this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
+ this.innerWriteLock = new WriteLock();
this.entryKey = new EntryKeyBytesValue();
- this.inputFirstValueBytesValue = new InputFirstValueBytesValue();
+ this.usingReturnValue = new UsingReturnValue();
+ this.innerUpdateLock = new UpdateLock();
}
public class InputKeyBytesValue extends AbstractValue {
@Override
- public T handle() {
- return ((T)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).handle(CompiledMapQueryContext.this.inputBytes())));
+ public long size() {
+ return CompiledMapQueryContext.this.inputKeySize();
+ }
+
+ public void closeInputKeyBytesValueSizeDependants() {
+ InputKeyBytesValue.this.closeInputKeyBytesValueGetUsingDependants();
}
@Override
@@ -193,17 +197,8 @@ public class CompiledMapQueryContext {
+ @Override
+ public T handle() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.entryBytesAccessHandle;
+ }
+
+ @Override
+ public ReadAccess access() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.entryBytesAccess;
+ }
+
@Override
public long size() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
@@ -314,18 +326,6 @@ public class CompiledMapQueryContext access() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.entryBytesAccess;
- }
-
- @Override
- public T handle() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.entryBytesAccessHandle;
- }
}
public class WriteLock implements InterProcessLock {
@@ -334,22 +334,6 @@ public class CompiledMapQueryContext {
@@ -625,6 +625,12 @@ public class CompiledMapQueryContext access() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
return CompiledMapQueryContext.this.entryBytesAccess;
}
+ @Override
+ public V get() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return cachedEntryValue();
+ }
+
@Override
public T handle() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
@@ -671,19 +677,18 @@ public class CompiledMapQueryContext {
+ @Override
+ public T handle() {
+ return ((T)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).handle(CompiledMapQueryContext.this.inputBytes())));
+ }
+
@Override
public ReadAccess access() {
return ((ReadAccess)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).access(CompiledMapQueryContext.this.inputBytes())));
@@ -744,22 +749,22 @@ public class CompiledMapQueryContext {
@Override
public T handle() {
return ((T)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).handle(CompiledMapQueryContext.this.inputBytes())));
}
- }
- public class InputSecondValueBytesValue extends AbstractValue {
@Override
public ReadAccess access() {
return ((ReadAccess)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).access(CompiledMapQueryContext.this.inputBytes())));
}
@Override
- public T handle() {
- return ((T)(JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).handle(CompiledMapQueryContext.this.inputBytes())));
+ public long offset() {
+ return JavaLangBytesAccessors.uncheckedBytesAccessor(CompiledMapQueryContext.this.inputBytes()).offset(CompiledMapQueryContext.this.inputBytes(), CompiledMapQueryContext.this.secondInputValueOffset());
}
@Override
@@ -771,11 +776,6 @@ public class CompiledMapQueryContext {
@@ -946,6 +946,24 @@ public class CompiledMapQueryContext {
@NotNull
@Override
- public InterProcessLock readLock() {
- return CompiledMapQueryContext.this.readLock();
+ public InterProcessLock writeLock() {
+ return CompiledMapQueryContext.this.writeLock();
}
@NotNull
@@ -1054,26 +1054,8 @@ public class CompiledMapQueryContext entry = CompiledMapQueryContext.this.entry();
+ if (entry != null) {
+ CompiledMapQueryContext.this.remove(entry);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean containsKey() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return (CompiledMapQueryContext.this.entry()) != null;
}
@Override
@@ -1107,9 +1128,8 @@ public class CompiledMapQueryContext entry = CompiledMapQueryContext.this.entry();
- if (entry != null) {
- CompiledMapQueryContext.this.remove(entry);
- return true;
- } else {
- return false;
- }
- }
-
- @NotNull
- @Override
- public K key() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.queriedKey().get();
- }
}
public enum SearchState {
@@ -1386,6 +1386,11 @@ public class CompiledMapQueryContext {
@@ -1746,67 +1746,6 @@ public class CompiledMapQueryContext context() {
- return this;
- }
-
- public T contextAtIndexInChain(int index) {
- return ((T)(contextChain.get(index)));
- }
-
- public void closeVanillaChronicleMapHolderImplContextAtIndexInChainDependants() {
- CompiledMapQueryContext.this.closeQuerySegmentStagesTryFindInitLocksOfThisSegmentDependants();
- }
-
- long sizeOfEverythingBeforeValue(long keySize, long valueSize) {
- return (((CompiledMapQueryContext.this.m().metaDataBytes) + (CompiledMapQueryContext.this.m().keySizeMarshaller.sizeEncodingSize(keySize))) + keySize) + (CompiledMapQueryContext.this.m().valueSizeMarshaller.sizeEncodingSize(valueSize));
- }
-
- public final long entrySize(long keySize, long valueSize) {
- long sizeOfEverythingBeforeValue = sizeOfEverythingBeforeValue(keySize, valueSize);
- return innerEntrySize(sizeOfEverythingBeforeValue, valueSize);
- }
-
public MVI valueMetaInterop(V value) {
return CompiledMapQueryContext.this.m().metaValueInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.m().originalMetaValueInterop, valueInterop, value);
}
@@ -1826,6 +1765,46 @@ public class CompiledMapQueryContextT contextAtIndexInChain(int index) {
+ return ((T)(contextChain.get(index)));
+ }
+
+ public void closeVanillaChronicleMapHolderImplContextAtIndexInChainDependants() {
+ CompiledMapQueryContext.this.closeQuerySegmentStagesTryFindInitLocksOfThisSegmentDependants();
+ }
+
+ public long entryBytesAccessOffset(long offset) {
+ return entryBytesAccessor.offset(entryBytes, offset);
+ }
+
+ public void closeMapEntryStagesEntryBytesAccessOffsetDependants() {
+ CompiledMapQueryContext.this.closeEntry();
+ CompiledMapQueryContext.this.closeValue();
+ CompiledMapQueryContext.this.closeMapQueryKeyEqualsDependants();
+ }
+
+ public void checkAccessingFromOwnerThread() {
+ if ((owner) != (Thread.currentThread())) {
+ throw new ConcurrentModificationException("Context shouldn\'t be accessed from multiple threads");
+ }
+ }
+
+ public void closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants() {
+ CompiledMapQueryContext.this.closeQueryCheckOnEachPublicOperationCheckOnEachPublicOperationDependants();
+ }
+
+ long sizeOfEverythingBeforeValue(long keySize, long valueSize) {
+ return (((CompiledMapQueryContext.this.m().metaDataBytes) + (CompiledMapQueryContext.this.m().keySizeMarshaller.sizeEncodingSize(keySize))) + keySize) + (CompiledMapQueryContext.this.m().valueSizeMarshaller.sizeEncodingSize(valueSize));
+ }
+
+ public MKI keyMetaInterop(K key) {
+ return CompiledMapQueryContext.this.h().metaKeyInteropProvider.get(CompiledMapQueryContext.this.copies, CompiledMapQueryContext.this.h().originalMetaKeyInterop, keyInterop, key);
+ }
+
+ public void closeKeyBytesInteropKeyMetaInteropDependants() {
+ CompiledMapQueryContext.this.inputKeyInstanceValue.closeBuffer();
+ }
+
private CompiledMapQueryContext _Chaining_createChaining() {
return new CompiledMapQueryContext(this);
}
@@ -1847,21 +1826,41 @@ public class CompiledMapQueryContext inputKey = null;
public boolean inputKeyInit() {
@@ -2116,269 +2132,11 @@ public class CompiledMapQueryContext= 0;
- }
-
- public void initSegmentHashLookup() {
- long hashLookupOffset = CompiledMapQueryContext.this.h().segmentOffset(CompiledMapQueryContext.this.segmentIndex());
- innerInitSegmentHashLookup(((CompiledMapQueryContext.this.h().ms.address()) + hashLookupOffset), CompiledMapQueryContext.this.h().segmentHashLookupCapacity, CompiledMapQueryContext.this.h().segmentHashLookupEntrySize, CompiledMapQueryContext.this.h().segmentHashLookupKeyBits, CompiledMapQueryContext.this.h().segmentHashLookupValueBits);
- this.closeSegmentHashLookupDependants();
- }
-
- public void initSegmentHashLookup(long address, long capacity, int entrySize, int keyBits, int valueBits) {
- innerInitSegmentHashLookup(address, capacity, entrySize, keyBits, valueBits);
- this.closeSegmentHashLookupDependants();
- }
-
- public int hashLookupEntrySize() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.hashLookupEntrySize;
- }
-
- public int keyBits() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.keyBits;
- }
-
- public long address() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.address;
- }
-
- public long capacityMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.capacityMask;
- }
-
- public long capacityMask2() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.capacityMask2;
- }
-
- public long entryMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.entryMask;
- }
-
- public long keyMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.keyMask;
- }
-
- public long valueMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.valueMask;
- }
-
- public void closeSegmentHashLookup() {
- if (!(this.segmentHashLookupInit()))
- return ;
-
- this.closeSegmentHashLookupDependants();
- this.address = -1;
- }
-
- public void closeSegmentHashLookupDependants() {
- CompiledMapQueryContext.this.closeHashLookupKeyDependants();
- CompiledMapQueryContext.this.closeHashLookupStepBackDependants();
- CompiledMapQueryContext.this.closeHashLookupEmptyDependants();
- CompiledMapQueryContext.this.closeHashLookupIndexToPosDependants();
- CompiledMapQueryContext.this.closeHashLookupHlPosDependants();
- CompiledMapQueryContext.this.closeHashLookupReadEntryDependants();
- CompiledMapQueryContext.this.closeHashLookupMaskUnsetKeyDependants();
- CompiledMapQueryContext.this.closeHashLookupValueDependants();
- CompiledMapQueryContext.this.closeHashLookupStepDependants();
- }
-
- void clearEntry(long pos, long prevEntry) {
- long entry = prevEntry & (~(entryMask()));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
- public long key(long entry) {
- return entry & (keyMask());
- }
-
- public void closeHashLookupKeyDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
- }
-
- public long stepBack(long pos) {
- return (pos -= hashLookupEntrySize()) >= 0 ? pos : capacityMask2();
- }
-
- public void closeHashLookupStepBackDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchFoundDependants();
- }
-
- void writeEntry(long pos, long prevEntry, long anotherEntry) {
- long entry = (prevEntry & (~(entryMask()))) | (anotherEntry & (entryMask()));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
- public boolean empty(long entry) {
- return (entry & (entryMask())) == (UNSET_ENTRY);
- }
-
- public void closeHashLookupEmptyDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- }
-
- long indexToPos(long index) {
- return index * (hashLookupEntrySize());
- }
-
- public void closeHashLookupIndexToPosDependants() {
- CompiledMapQueryContext.this.closeHashLookupHlPosDependants();
- }
-
- public long hlPos(long key) {
- return indexToPos((key & (capacityMask())));
- }
-
- public void closeHashLookupHlPosDependants() {
- CompiledMapQueryContext.this.closeSearchKey();
- }
-
- public long readEntry(long pos) {
- return NativeBytes.UNSAFE.getLong(((address()) + pos));
- }
-
- public void closeHashLookupReadEntryDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
- }
-
- public long maskUnsetKey(long key) {
- return (key &= keyMask()) != (UNSET_KEY) ? key : keyMask();
- }
-
- public void closeHashLookupMaskUnsetKeyDependants() {
- CompiledMapQueryContext.this.closeSearchKey();
- }
-
- public long value(long entry) {
- return (entry >>> (keyBits())) & (valueMask());
- }
-
- public void closeHashLookupValueDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
- }
-
- void forEach(EntryConsumer action) {
- for (long pos = 0L ; pos <= (capacityMask2()) ; pos += hashLookupEntrySize()) {
- long entry = readEntry(pos);
- if (!(empty(entry)))
- action.accept(key(entry), value(entry));
-
- }
- }
-
- String hashLookupToString() {
- final StringBuilder sb = new StringBuilder("{");
- forEach((long key,long value) -> sb.append(key).append('=').append(value).append(','));
- sb.append('}');
- return sb.toString();
- }
-
- public void checkValueForPut(long value) {
- assert (value & (~(valueMask()))) == 0L : "Value out of range, was " + value;
- }
-
- public long step(long pos) {
- return (pos += hashLookupEntrySize()) <= (capacityMask2()) ? pos : 0L;
- }
-
- public void closeHashLookupStepDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- }
-
- public long remove(long posToRemove) {
- long entryToRemove = readEntry(posToRemove);
- long posToShift = posToRemove;
- while (true) {
- posToShift = step(posToShift);
- long entryToShift = readEntry(posToShift);
- if (empty(entryToShift))
- break;
-
- long insertPos = hlPos(key(entryToShift));
- boolean cond1 = insertPos <= posToRemove;
- boolean cond2 = posToRemove <= posToShift;
- if ((cond1 && cond2) || ((posToShift < insertPos) && (cond1 || cond2))) {
- writeEntry(posToRemove, entryToRemove, entryToShift);
- posToRemove = posToShift;
- entryToRemove = entryToShift;
- }
- }
- clearEntry(posToRemove, entryToRemove);
- return posToRemove;
- }
-
- public void clearHashLookup() {
- NativeBytes.UNSAFE.setMemory(address(), ((capacityMask2()) + (hashLookupEntrySize())), ((byte)(0)));
- }
-
- long entry(long key, long value) {
- return key | (value << (keyBits()));
- }
-
- public void writeEntryVolatile(long pos, long prevEntry, long key, long value) {
- long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
- NativeBytes.UNSAFE.putLongVolatile(null, ((address()) + pos), entry);
- }
-
- public void putValueVolatile(long pos, long value) {
- checkValueForPut(value);
- long currentEntry = readEntry(pos);
- writeEntryVolatile(pos, currentEntry, key(currentEntry), value);
- }
-
- public void writeEntry(long pos, long prevEntry, long key, long value) {
- long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
long segmentHeaderAddress;
SegmentHeader segmentHeader = null;
@@ -2421,16 +2179,8 @@ public class CompiledMapQueryContext= (CompiledMapQueryContext.this.h().actualChunksPerSegment))
+ nextPosToSearchFrom = 0L;
+
+ nextPosToSearchFrom(nextPosToSearchFrom);
+ }
+
+ public long deleted() {
+ return segmentHeader().deleted(segmentHeaderAddress());
+ }
+
+ public long size() {
+ return (entries()) - (deleted());
+ }
+
+ long nextPosToSearchFrom() {
+ return segmentHeader().nextPosToSearchFrom(segmentHeaderAddress());
+ }
+
+ public void deleted(long deleted) {
+ segmentHeader().deleted(segmentHeaderAddress(), deleted);
+ }
+
int totalReadLockCount;
int totalUpdateLockCount;
@@ -2546,28 +2324,413 @@ public class CompiledMapQueryContext= 0;
}
- public long size() {
- return (entries()) - (deleted());
+ public void initSegmentHashLookup() {
+ long hashLookupOffset = CompiledMapQueryContext.this.h().segmentOffset(CompiledMapQueryContext.this.segmentIndex());
+ innerInitSegmentHashLookup(((CompiledMapQueryContext.this.h().ms.address()) + hashLookupOffset), CompiledMapQueryContext.this.h().segmentHashLookupCapacity, CompiledMapQueryContext.this.h().segmentHashLookupEntrySize, CompiledMapQueryContext.this.h().segmentHashLookupKeyBits, CompiledMapQueryContext.this.h().segmentHashLookupValueBits);
+ this.closeSegmentHashLookupDependants();
}
- public void nextPosToSearchFrom(long nextPosToSearchFrom) {
- segmentHeader().nextPosToSearchFrom(segmentHeaderAddress(), nextPosToSearchFrom);
+ public void initSegmentHashLookup(long address, long capacity, int entrySize, int keyBits, int valueBits) {
+ innerInitSegmentHashLookup(address, capacity, entrySize, keyBits, valueBits);
+ this.closeSegmentHashLookupDependants();
}
- public void updateNextPosToSearchFrom(long allocated, int chunks) {
- long nextPosToSearchFrom = allocated + chunks;
- if (nextPosToSearchFrom >= (CompiledMapQueryContext.this.h().actualChunksPerSegment))
- nextPosToSearchFrom = 0L;
+ public int hashLookupEntrySize() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
- nextPosToSearchFrom(nextPosToSearchFrom);
+ return this.hashLookupEntrySize;
+ }
+
+ public int keyBits() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.keyBits;
+ }
+
+ public long address() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.address;
+ }
+
+ public long capacityMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.capacityMask;
+ }
+
+ public long capacityMask2() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.capacityMask2;
+ }
+
+ public long entryMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.entryMask;
+ }
+
+ public long keyMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.keyMask;
+ }
+
+ public long valueMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.valueMask;
+ }
+
+ public void closeSegmentHashLookup() {
+ if (!(this.segmentHashLookupInit()))
+ return ;
+
+ this.closeSegmentHashLookupDependants();
+ this.address = -1;
+ }
+
+ public void closeSegmentHashLookupDependants() {
+ CompiledMapQueryContext.this.closeHashLookupStepBackDependants();
+ CompiledMapQueryContext.this.closeHashLookupStepDependants();
+ CompiledMapQueryContext.this.closeHashLookupMaskUnsetKeyDependants();
+ CompiledMapQueryContext.this.closeHashLookupReadEntryDependants();
+ CompiledMapQueryContext.this.closeHashLookupIndexToPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupHlPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupValueDependants();
+ CompiledMapQueryContext.this.closeHashLookupEmptyDependants();
+ CompiledMapQueryContext.this.closeHashLookupKeyDependants();
+ }
+
+ public long stepBack(long pos) {
+ return (pos -= hashLookupEntrySize()) >= 0 ? pos : capacityMask2();
+ }
+
+ public void closeHashLookupStepBackDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchFoundDependants();
+ }
+
+ void clearEntry(long pos, long prevEntry) {
+ long entry = prevEntry & (~(entryMask()));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ public void clearHashLookup() {
+ NativeBytes.UNSAFE.setMemory(address(), ((capacityMask2()) + (hashLookupEntrySize())), ((byte)(0)));
+ }
+
+ public void checkValueForPut(long value) {
+ assert (value & (~(valueMask()))) == 0L : "Value out of range, was " + value;
+ }
+
+ public long step(long pos) {
+ return (pos += hashLookupEntrySize()) <= (capacityMask2()) ? pos : 0L;
+ }
+
+ public void closeHashLookupStepDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ }
+
+ public long maskUnsetKey(long key) {
+ return (key &= keyMask()) != (UNSET_KEY) ? key : keyMask();
+ }
+
+ public void closeHashLookupMaskUnsetKeyDependants() {
+ CompiledMapQueryContext.this.closeSearchKey();
+ }
+
+ public long readEntry(long pos) {
+ return NativeBytes.UNSAFE.getLong(((address()) + pos));
+ }
+
+ public void closeHashLookupReadEntryDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
+ }
+
+ long entry(long key, long value) {
+ return key | (value << (keyBits()));
+ }
+
+ public void writeEntryVolatile(long pos, long prevEntry, long key, long value) {
+ long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
+ NativeBytes.UNSAFE.putLongVolatile(null, ((address()) + pos), entry);
+ }
+
+ public void writeEntry(long pos, long prevEntry, long key, long value) {
+ long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ long indexToPos(long index) {
+ return index * (hashLookupEntrySize());
+ }
+
+ public void closeHashLookupIndexToPosDependants() {
+ CompiledMapQueryContext.this.closeHashLookupHlPosDependants();
+ }
+
+ public long hlPos(long key) {
+ return indexToPos((key & (capacityMask())));
+ }
+
+ public void closeHashLookupHlPosDependants() {
+ CompiledMapQueryContext.this.closeSearchKey();
+ }
+
+ long searchKey = UNSET_KEY;
+
+ long searchStartPos;
+
+ public boolean searchKeyInit() {
+ return (this.searchKey) != (UNSET_KEY);
+ }
+
+ void initSearchKey() {
+ searchKey = CompiledMapQueryContext.this.maskUnsetKey(CompiledMapQueryContext.this.h().hashSplitting.segmentHash(CompiledMapQueryContext.this.hashOfKey()));
+ searchStartPos = CompiledMapQueryContext.this.hlPos(searchKey);
+ this.closeSearchKeyDependants();
+ }
+
+ public long searchKey() {
+ if (!(this.searchKeyInit()))
+ this.initSearchKey();
+
+ return this.searchKey;
+ }
+
+ public long searchStartPos() {
+ if (!(this.searchKeyInit()))
+ this.initSearchKey();
+
+ return this.searchStartPos;
+ }
+
+ public void closeSearchKey() {
+ if (!(this.searchKeyInit()))
+ return ;
+
+ this.closeSearchKeyDependants();
+ this.searchKey = UNSET_KEY;
+ }
+
+ public void closeSearchKeyDependants() {
+ CompiledMapQueryContext.this.closeHashLookupPos();
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
+ }
+
+ public long hashLookupPos = -1;
+
+ public boolean hashLookupPosInit() {
+ return (this.hashLookupPos) >= 0;
+ }
+
+ public void initHashLookupPos() {
+ CompiledMapQueryContext.this.innerReadLock.lock();
+ this.hashLookupPos = CompiledMapQueryContext.this.searchStartPos();
+ this.closeHashLookupPosDependants();
+ }
+
+ public void initHashLookupPos(long hashLookupPos) {
+ this.hashLookupPos = hashLookupPos;
+ this.closeHashLookupPosDependants();
+ }
+
+ public long hashLookupPos() {
+ if (!(this.hashLookupPosInit()))
+ this.initHashLookupPos();
+
+ return this.hashLookupPos;
+ }
+
+ public void closeHashLookupPos() {
+ if (!(this.hashLookupPosInit()))
+ return ;
+
+ this.closeHashLookupPosDependants();
+ this.hashLookupPos = -1;
+ }
+
+ public void closeHashLookupPosDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchFoundDependants();
+ }
+
+ void put(long value) {
+ CompiledMapQueryContext.this.checkValueForPut(value);
+ CompiledMapQueryContext.this.writeEntry(CompiledMapQueryContext.this.hashLookupPos(), CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos()), searchKey(), value);
+ }
+
+ public void putNewVolatile(long value) {
+ CompiledMapQueryContext.this.checkValueForPut(value);
+ long currentEntry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
+ CompiledMapQueryContext.this.writeEntryVolatile(CompiledMapQueryContext.this.hashLookupPos(), currentEntry, searchKey(), value);
+ }
+
+ public void found() {
+ CompiledMapQueryContext.this.setHashLookupPosGuarded(CompiledMapQueryContext.this.stepBack(CompiledMapQueryContext.this.hashLookupPos()));
+ }
+
+ public void closeHashLookupSearchFoundDependants() {
+ CompiledMapQueryContext.this.closeKeySearch();
+ }
+
+ public long value(long entry) {
+ return (entry >>> (keyBits())) & (valueMask());
+ }
+
+ public void closeHashLookupValueDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
+ }
+
+ public boolean empty(long entry) {
+ return (entry & (entryMask())) == (UNSET_ENTRY);
+ }
+
+ public void closeHashLookupEmptyDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ }
+
+ public boolean checkSlotIsEmpty() {
+ return CompiledMapQueryContext.this.empty(CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos()));
+ }
+
+ public long key(long entry) {
+ return entry & (keyMask());
+ }
+
+ public void closeHashLookupKeyDependants() {
+ CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
+ CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
+ }
+
+ public void putVolatile(long value) {
+ CompiledMapQueryContext.this.checkValueForPut(value);
+ long currentEntry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
+ assert (CompiledMapQueryContext.this.key(currentEntry)) == (searchKey());
+ CompiledMapQueryContext.this.writeEntryVolatile(CompiledMapQueryContext.this.hashLookupPos(), currentEntry, searchKey(), value);
+ }
+
+ void forEach(EntryConsumer action) {
+ for (long pos = 0L ; pos <= (capacityMask2()) ; pos += hashLookupEntrySize()) {
+ long entry = readEntry(pos);
+ if (!(empty(entry)))
+ action.accept(key(entry), value(entry));
+
+ }
+ }
+
+ String hashLookupToString() {
+ final StringBuilder sb = new StringBuilder("{");
+ forEach((long key,long value) -> sb.append(key).append('=').append(value).append(','));
+ sb.append('}');
+ return sb.toString();
+ }
+
+ public long nextPos() {
+ long pos = CompiledMapQueryContext.this.hashLookupPos();
+ while (true) {
+ long entry = CompiledMapQueryContext.this.readEntry(pos);
+ if (CompiledMapQueryContext.this.empty(entry)) {
+ CompiledMapQueryContext.this.setHashLookupPosGuarded(pos);
+ return -1L;
+ }
+ pos = CompiledMapQueryContext.this.step(pos);
+ if (pos == (searchStartPos()))
+ break;
+
+ if ((CompiledMapQueryContext.this.key(entry)) == (searchKey())) {
+ CompiledMapQueryContext.this.setHashLookupPosGuarded(pos);
+ return CompiledMapQueryContext.this.value(entry);
+ }
+ }
+ throw new IllegalStateException(("MultiMap is full, that most likely means you " + ("misconfigured entrySize/chunkSize, and entries tend to take less chunks than " + "expected")));
+ }
+
+ public void closeHashLookupSearchNextPosDependants() {
+ CompiledMapQueryContext.this.closeKeySearch();
+ }
+
+ public boolean checkSlotContainsExpectedKeyAndValue(long value) {
+ long entry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
+ return ((CompiledMapQueryContext.this.key(entry)) == (searchKey())) && ((CompiledMapQueryContext.this.value(entry)) == value);
+ }
+
+ public void closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants() {
+ CompiledMapQueryContext.this.closeMapQueryDropSearchIfNestedContextsAndPresentHashLookupSlotCheckFailedDependants();
+ }
+
+ public void putValueVolatile(long pos, long value) {
+ checkValueForPut(value);
+ long currentEntry = readEntry(pos);
+ writeEntryVolatile(pos, currentEntry, key(currentEntry), value);
+ }
+
+ void writeEntry(long pos, long prevEntry, long anotherEntry) {
+ long entry = (prevEntry & (~(entryMask()))) | (anotherEntry & (entryMask()));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ public long remove(long posToRemove) {
+ long entryToRemove = readEntry(posToRemove);
+ long posToShift = posToRemove;
+ while (true) {
+ posToShift = step(posToShift);
+ long entryToShift = readEntry(posToShift);
+ if (empty(entryToShift))
+ break;
+
+ long insertPos = hlPos(key(entryToShift));
+ boolean cond1 = insertPos <= posToRemove;
+ boolean cond2 = posToRemove <= posToShift;
+ if ((cond1 && cond2) || ((posToShift < insertPos) && (cond1 || cond2))) {
+ writeEntry(posToRemove, entryToRemove, entryToShift);
+ posToRemove = posToShift;
+ entryToRemove = entryToShift;
+ }
+ }
+ clearEntry(posToRemove, entryToRemove);
+ return posToRemove;
+ }
+
+ public void remove() {
+ CompiledMapQueryContext.this.setHashLookupPosGuarded(CompiledMapQueryContext.this.remove(CompiledMapQueryContext.this.hashLookupPos()));
}
long entrySpaceOffset = 0;
@@ -2635,36 +2798,6 @@ public class CompiledMapQueryContext h = CompiledMapQueryContext.this.h();
- if (chunks > (h.maxChunksPerEntry))
- throw new IllegalArgumentException((((("Entry is too large: requires " + chunks) + " entry size chucks, ") + (h.maxChunksPerEntry)) + " is maximum."));
-
- long ret = freeList().setNextNContinuousClearBits(nextPosToSearchFrom(), chunks);
- if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
- if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
- freeList().clear(ret, h.actualChunksPerSegment);
-
- ret = freeList().setNextNContinuousClearBits(0L, chunks);
- if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
- if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
- freeList().clear(ret, h.actualChunksPerSegment);
-
- if (chunks == 1) {
- throw new IllegalStateException("Segment is full, no free entries found");
- } else {
- throw new IllegalStateException((("Segment is full or has no ranges of " + chunks) + " continuous free chunks"));
- }
- }
- updateNextPosToSearchFrom(ret, chunks);
- } else {
- if ((chunks == 1) || (freeList().isSet(nextPosToSearchFrom()))) {
- updateNextPosToSearchFrom(ret, chunks);
- }
- }
- return ret;
- }
-
public long pos = -1;
public long keySizeOffset;
@@ -2831,9 +2964,9 @@ public class CompiledMapQueryContext value) {
+ initValue(value);
+ freeExtraAllocatedChunks();
+ CompiledMapQueryContext.this.putValueVolatile(CompiledMapQueryContext.this.hashLookupPos(), pos());
+ }
+
public long newSizeOfEverythingBeforeValue(Value newValue) {
return ((valueSizeOffset()) + (CompiledMapQueryContext.this.m().valueSizeMarshaller.sizeEncodingSize(newValue.size()))) - (keySizeOffset());
}
@@ -2894,151 +3041,34 @@ public class CompiledMapQueryContext h = CompiledMapQueryContext.this.h();
+ if (chunks > (h.maxChunksPerEntry))
+ throw new IllegalArgumentException((((("Entry is too large: requires " + chunks) + " entry size chucks, ") + (h.maxChunksPerEntry)) + " is maximum."));
- long searchStartPos;
+ long ret = freeList().setNextNContinuousClearBits(nextPosToSearchFrom(), chunks);
+ if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
+ if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
+ freeList().clear(ret, h.actualChunksPerSegment);
- public boolean searchKeyInit() {
- return (this.searchKey) != (UNSET_KEY);
- }
+ ret = freeList().setNextNContinuousClearBits(0L, chunks);
+ if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
+ if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
+ freeList().clear(ret, h.actualChunksPerSegment);
- void initSearchKey() {
- searchKey = CompiledMapQueryContext.this.maskUnsetKey(CompiledMapQueryContext.this.h().hashSplitting.segmentHash(CompiledMapQueryContext.this.hashOfKey()));
- searchStartPos = CompiledMapQueryContext.this.hlPos(searchKey);
- this.closeSearchKeyDependants();
- }
-
- public long searchKey() {
- if (!(this.searchKeyInit()))
- this.initSearchKey();
-
- return this.searchKey;
- }
-
- public long searchStartPos() {
- if (!(this.searchKeyInit()))
- this.initSearchKey();
-
- return this.searchStartPos;
- }
-
- public void closeSearchKey() {
- if (!(this.searchKeyInit()))
- return ;
-
- this.closeSearchKeyDependants();
- this.searchKey = UNSET_KEY;
- }
-
- public void closeSearchKeyDependants() {
- CompiledMapQueryContext.this.closeHashLookupPos();
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
- }
-
- public long hashLookupPos = -1;
-
- public boolean hashLookupPosInit() {
- return (this.hashLookupPos) >= 0;
- }
-
- public void initHashLookupPos() {
- CompiledMapQueryContext.this.innerReadLock.lock();
- this.hashLookupPos = CompiledMapQueryContext.this.searchStartPos();
- this.closeHashLookupPosDependants();
- }
-
- public void initHashLookupPos(long hashLookupPos) {
- this.hashLookupPos = hashLookupPos;
- this.closeHashLookupPosDependants();
- }
-
- public long hashLookupPos() {
- if (!(this.hashLookupPosInit()))
- this.initHashLookupPos();
-
- return this.hashLookupPos;
- }
-
- public void closeHashLookupPos() {
- if (!(this.hashLookupPosInit()))
- return ;
-
- this.closeHashLookupPosDependants();
- this.hashLookupPos = -1;
- }
-
- public void closeHashLookupPosDependants() {
- CompiledMapQueryContext.this.closeHashLookupSearchNextPosDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants();
- CompiledMapQueryContext.this.closeHashLookupSearchFoundDependants();
- }
-
- public void remove() {
- CompiledMapQueryContext.this.setHashLookupPosGuarded(CompiledMapQueryContext.this.remove(CompiledMapQueryContext.this.hashLookupPos()));
- }
-
- public void putNewVolatile(long value) {
- CompiledMapQueryContext.this.checkValueForPut(value);
- long currentEntry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
- CompiledMapQueryContext.this.writeEntryVolatile(CompiledMapQueryContext.this.hashLookupPos(), currentEntry, searchKey(), value);
- }
-
- public long nextPos() {
- long pos = CompiledMapQueryContext.this.hashLookupPos();
- while (true) {
- long entry = CompiledMapQueryContext.this.readEntry(pos);
- if (CompiledMapQueryContext.this.empty(entry)) {
- CompiledMapQueryContext.this.setHashLookupPosGuarded(pos);
- return -1L;
+ if (chunks == 1) {
+ throw new IllegalStateException("Segment is full, no free entries found");
+ } else {
+ throw new IllegalStateException((("Segment is full or has no ranges of " + chunks) + " continuous free chunks"));
+ }
}
- pos = CompiledMapQueryContext.this.step(pos);
- if (pos == (searchStartPos()))
- break;
-
- if ((CompiledMapQueryContext.this.key(entry)) == (searchKey())) {
- CompiledMapQueryContext.this.setHashLookupPosGuarded(pos);
- return CompiledMapQueryContext.this.value(entry);
+ updateNextPosToSearchFrom(ret, chunks);
+ } else {
+ if ((chunks == 1) || (freeList().isSet(nextPosToSearchFrom()))) {
+ updateNextPosToSearchFrom(ret, chunks);
}
}
- throw new IllegalStateException(("MultiMap is full, that most likely means you " + ("misconfigured entrySize/chunkSize, and entries tend to take less chunks than " + "expected")));
- }
-
- public void closeHashLookupSearchNextPosDependants() {
- CompiledMapQueryContext.this.closeKeySearch();
- }
-
- public void putVolatile(long value) {
- CompiledMapQueryContext.this.checkValueForPut(value);
- long currentEntry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
- assert (CompiledMapQueryContext.this.key(currentEntry)) == (searchKey());
- CompiledMapQueryContext.this.writeEntryVolatile(CompiledMapQueryContext.this.hashLookupPos(), currentEntry, searchKey(), value);
- }
-
- public boolean checkSlotContainsExpectedKeyAndValue(long value) {
- long entry = CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos());
- return ((CompiledMapQueryContext.this.key(entry)) == (searchKey())) && ((CompiledMapQueryContext.this.value(entry)) == value);
- }
-
- public void closeHashLookupSearchCheckSlotContainsExpectedKeyAndValueDependants() {
- CompiledMapQueryContext.this.closeMapQueryDropSearchIfNestedContextsAndPresentHashLookupSlotCheckFailedDependants();
- }
-
- public boolean checkSlotIsEmpty() {
- return CompiledMapQueryContext.this.empty(CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos()));
- }
-
- public void found() {
- CompiledMapQueryContext.this.setHashLookupPosGuarded(CompiledMapQueryContext.this.stepBack(CompiledMapQueryContext.this.hashLookupPos()));
- }
-
- public void closeHashLookupSearchFoundDependants() {
- CompiledMapQueryContext.this.closeKeySearch();
- }
-
- void put(long value) {
- CompiledMapQueryContext.this.checkValueForPut(value);
- CompiledMapQueryContext.this.writeEntry(CompiledMapQueryContext.this.hashLookupPos(), CompiledMapQueryContext.this.readEntry(CompiledMapQueryContext.this.hashLookupPos()), searchKey(), value);
+ return ret;
}
boolean keyEquals() {
@@ -3088,31 +3118,10 @@ public class CompiledMapQueryContext defaultValue() {
+ public InterProcessLock updateLock() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return wrapValueAsValue(CompiledMapQueryContext.this.m().defaultValue(CompiledMapQueryContext.this.deprecatedMapKeyContext));
+ return CompiledMapQueryContext.this.innerUpdateLock;
}
@Override
- public R insert(@NotNull
- MapAbsentEntry absentEntry, Value value) {
+ public Value defaultValue(@NotNull
+ MapAbsentEntry absentEntry) {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.m().entryOperations.insert(absentEntry, value);
+ return CompiledMapQueryContext.this.m().entryOperations.defaultValue(absentEntry);
}
@Override
@@ -3173,6 +3182,53 @@ public class CompiledMapQueryContext key() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.entryKey;
+ }
+
+ @NotNull
+ @Override
+ public Value defaultValue() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.wrapValueAsValue(CompiledMapQueryContext.this.m().defaultValue(CompiledMapQueryContext.this.deprecatedMapKeyContext));
+ }
+
+ @Override
+ public R remove(@NotNull
+ MapEntry entry) {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.m().entryOperations.remove(entry);
+ }
+
+ @NotNull
+ @Override
+ public InterProcessLock readLock() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.innerReadLock;
+ }
+
+ @NotNull
+ @Override
+ public MapContext context() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return this;
+ }
+
+ @NotNull
+ @Override
+ public Value value() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return CompiledMapQueryContext.this.entryValue;
+ }
+
+ public Value queriedKey() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ return inputKey();
+ }
+
@Override
public Value wrapValueAsValue(V value) {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
@@ -3184,42 +3240,31 @@ public class CompiledMapQueryContext absentKey() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.innerUpdateLock;
- }
-
- @NotNull
- @Override
- public Value value() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.entryValue;
+ return CompiledMapQueryContext.this.inputKey();
}
@Override
- public Value defaultValue(@NotNull
- MapAbsentEntry absentEntry) {
+ public R insert(@NotNull
+ MapAbsentEntry absentEntry, Value value) {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.m().entryOperations.defaultValue(absentEntry);
+ return CompiledMapQueryContext.this.m().entryOperations.insert(absentEntry, value);
}
- @NotNull
+ public boolean searchStatePresent() {
+ return (searchState()) == (SearchState.PRESENT);
+ }
+
+ public boolean entryPresent() {
+ return searchStatePresent();
+ }
+
+ @Nullable
@Override
- public InterProcessLock readLock() {
+ public MapAbsentEntry absentEntry() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.innerReadLock;
- }
-
- @NotNull
- @Override
- public Value key() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.entryKey;
- }
-
- public Value queriedKey() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return inputKey();
+ return entryPresent() ? null : CompiledMapQueryContext.this;
}
@Override
@@ -3228,14 +3273,11 @@ public class CompiledMapQueryContext entry) {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return CompiledMapQueryContext.this.m().entryOperations.remove(entry);
+ public boolean searchStateAbsent() {
+ return (!(searchStatePresent())) && (!(searchStateDeleted()));
}
- private void putPrefix() {
+ protected void putPrefix() {
CompiledMapQueryContext.this.checkOnEachPublicOperation();
boolean underUpdatedLockIsHeld = !(CompiledMapQueryContext.this.innerUpdateLock.isHeldByCurrentThread());
if (underUpdatedLockIsHeld)
@@ -3247,144 +3289,21 @@ public class CompiledMapQueryContext absentEntry() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return entryPresent() ? null : this;
+ private void _AllocatedChunks_incrementSegmentEntriesIfNeeded() {
}
- @Override
- public void doRemove() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- CompiledMapQueryContext.this.innerUpdateLock.lock();
- if (searchStatePresent()) {
- CompiledMapQueryContext.this.innerWriteLock.lock();
- CompiledMapQueryContext.this.remove();
- CompiledMapQueryContext.this.innerRemoveEntryExceptHashLookupUpdate();
- setSearchStateGuarded(SearchState.DELETED);
- } else {
- throw new IllegalStateException("Entry is absent when doRemove() is called");
+ public void incrementSegmentEntriesIfNeeded() {
+ if ((CompiledMapQueryContext.this.searchState()) != (SearchState.PRESENT)) {
+ CompiledMapQueryContext.this.entries(((CompiledMapQueryContext.this.entries()) + 1L));
}
}
- @NotNull
- @Override
- public Value absentKey() {
- CompiledMapQueryContext.this.checkOnEachPublicOperation();
- return inputKey();
- }
-
- public int allocatedChunks = 0;
-
- public boolean allocatedChunksInit() {
- return (this.allocatedChunks) != 0;
- }
-
- public void initAllocatedChunks(int allocatedChunks) {
- this.allocatedChunks = allocatedChunks;
- }
-
- public int allocatedChunks() {
- assert this.allocatedChunksInit() : "AllocatedChunks should be init";
- return this.allocatedChunks;
- }
-
- public void closeAllocatedChunks() {
- if (!(this.allocatedChunksInit()))
- return ;
-
- this.allocatedChunks = 0;
- }
-
- public final void freeExtraAllocatedChunks() {
- if (((!(CompiledMapQueryContext.this.m().constantlySizedEntry)) && (CompiledMapQueryContext.this.m().couldNotDetermineAlignmentBeforeAllocation)) && ((entrySizeInChunks()) < (CompiledMapQueryContext.this.allocatedChunks()))) {
- CompiledMapQueryContext.this.free(((pos()) + (entrySizeInChunks())), ((CompiledMapQueryContext.this.allocatedChunks()) - (entrySizeInChunks())));
- } else {
- initTheEntrySizeInChunks(CompiledMapQueryContext.this.allocatedChunks());
- }
- }
-
- public void writeValueAndPutPos(Value value) {
- initValue(value);
- freeExtraAllocatedChunks();
- CompiledMapQueryContext.this.putValueVolatile(CompiledMapQueryContext.this.hashLookupPos(), pos());
- }
-
- public void initEntryAndKey(long entrySize) {
- initAllocatedChunks(CompiledMapQueryContext.this.h().inChunks(entrySize));
- CompiledMapQueryContext.this.initEntry(CompiledMapQueryContext.this.alloc(allocatedChunks()), CompiledMapQueryContext.this.inputKey());
- incrementSegmentEntriesIfNeeded();
- }
-
- void putEntry(Value value) {
- assert searchStateAbsent();
- long entrySize = CompiledMapQueryContext.this.entrySize(inputKey().size(), value.size());
- CompiledMapQueryContext.this.initEntryAndKey(entrySize);
- CompiledMapQueryContext.this.initValue(value);
- CompiledMapQueryContext.this.freeExtraAllocatedChunks();
- CompiledMapQueryContext.this.putNewVolatile(CompiledMapQueryContext.this.pos());
- }
-
public void initEntryAndKeyCopying(long entrySize, long bytesToCopy) {
initAllocatedChunks(CompiledMapQueryContext.this.h().inChunks(entrySize));
CompiledMapQueryContext.this.initEntryCopying(CompiledMapQueryContext.this.alloc(allocatedChunks()), bytesToCopy);
incrementSegmentEntriesIfNeeded();
}
- protected void relocation(Value newValue, long newSizeOfEverythingBeforeValue) {
- CompiledMapQueryContext.this.free(pos(), entrySizeInChunks());
- long entrySize = innerEntrySize(newSizeOfEverythingBeforeValue, newValue.size());
- CompiledMapQueryContext.this.initEntryAndKeyCopying(entrySize, ((valueSizeOffset()) - (keySizeOffset())));
- writeValueAndPutPos(newValue);
- }
-
- public void innerDefaultReplaceValue(Value newValue) {
- assert CompiledMapQueryContext.this.innerUpdateLock.isHeldByCurrentThread();
- boolean newValueSizeIsDifferent = (newValue.size()) != (this.valueSize());
- if (newValueSizeIsDifferent) {
- long newSizeOfEverythingBeforeValue = newSizeOfEverythingBeforeValue(newValue);
- long entryStartOffset = keySizeOffset();
- VanillaChronicleMap, ?, ?, ?, ?, ?, ?> m = CompiledMapQueryContext.this.m();
- long newValueOffset = m.alignment.alignAddr((entryStartOffset + newSizeOfEverythingBeforeValue));
- long newEntrySize = (newValueOffset + (newValue.size())) - entryStartOffset;
- int newSizeInChunks = m.inChunks(newEntrySize);
- newValueDoesNotFit : if (newSizeInChunks > (entrySizeInChunks())) {
- if (newSizeInChunks > (m.maxChunksPerEntry)) {
- throw new IllegalArgumentException(((((("Value too large: " + "entry takes ") + newSizeInChunks) + " chunks, ") + (m.maxChunksPerEntry)) + " is maximum."));
- }
- if (CompiledMapQueryContext.this.freeList().allClear(((pos()) + (entrySizeInChunks())), ((pos()) + newSizeInChunks))) {
- CompiledMapQueryContext.this.freeList().set(((pos()) + (entrySizeInChunks())), ((pos()) + newSizeInChunks));
- break newValueDoesNotFit;
- }
- relocation(newValue, newSizeOfEverythingBeforeValue);
- return ;
- } else if (newSizeInChunks < (entrySizeInChunks())) {
- CompiledMapQueryContext.this.freeList().clear(((pos()) + newSizeInChunks), ((pos()) + (entrySizeInChunks())));
- }
- } else {
- }
- CompiledMapQueryContext.this.innerWriteLock.lock();
- if (newValueSizeIsDifferent) {
- initValueAgain(newValue);
- } else {
- writeValueGuarded(newValue);
- }
- CompiledMapQueryContext.this.putValueVolatile(CompiledMapQueryContext.this.hashLookupPos(), pos());
- }
-
- @Override
- public void doReplaceValue(Value newValue) {
- putPrefix();
- if (searchStatePresent()) {
- CompiledMapQueryContext.this.innerDefaultReplaceValue(newValue);
- CompiledMapQueryContext.this.incrementModCountGuarded();
- setSearchStateGuarded(SearchState.PRESENT);
- } else {
- throw new IllegalStateException("Entry is absent in the map when doReplaceValue() is called");
- }
- }
-
public void putValueDeletedEntry(Value newValue) {
assert CompiledMapQueryContext.this.innerUpdateLock.isHeldByCurrentThread();
int newSizeInChunks;
@@ -3430,19 +3349,101 @@ public class CompiledMapQueryContext newValue, long newSizeOfEverythingBeforeValue) {
+ CompiledMapQueryContext.this.free(pos(), entrySizeInChunks());
+ long entrySize = innerEntrySize(newSizeOfEverythingBeforeValue, newValue.size());
+ CompiledMapQueryContext.this.initEntryAndKeyCopying(entrySize, ((valueSizeOffset()) - (keySizeOffset())));
+ writeValueAndPutPos(newValue);
+ }
+
+ public void innerDefaultReplaceValue(Value newValue) {
+ assert CompiledMapQueryContext.this.innerUpdateLock.isHeldByCurrentThread();
+ boolean newValueSizeIsDifferent = (newValue.size()) != (this.valueSize());
+ if (newValueSizeIsDifferent) {
+ long newSizeOfEverythingBeforeValue = newSizeOfEverythingBeforeValue(newValue);
+ long entryStartOffset = keySizeOffset();
+ VanillaChronicleMap, ?, ?, ?, ?, ?, ?> m = CompiledMapQueryContext.this.m();
+ long newValueOffset = m.alignment.alignAddr((entryStartOffset + newSizeOfEverythingBeforeValue));
+ long newEntrySize = (newValueOffset + (newValue.size())) - entryStartOffset;
+ int newSizeInChunks = m.inChunks(newEntrySize);
+ newValueDoesNotFit : if (newSizeInChunks > (entrySizeInChunks())) {
+ if (newSizeInChunks > (m.maxChunksPerEntry)) {
+ throw new IllegalArgumentException(((((("Value too large: " + "entry takes ") + newSizeInChunks) + " chunks, ") + (m.maxChunksPerEntry)) + " is maximum."));
+ }
+ if (CompiledMapQueryContext.this.freeList().allClear(((pos()) + (entrySizeInChunks())), ((pos()) + newSizeInChunks))) {
+ CompiledMapQueryContext.this.freeList().set(((pos()) + (entrySizeInChunks())), ((pos()) + newSizeInChunks));
+ break newValueDoesNotFit;
+ }
+ relocation(newValue, newSizeOfEverythingBeforeValue);
+ return ;
+ } else if (newSizeInChunks < (entrySizeInChunks())) {
+ CompiledMapQueryContext.this.freeList().clear(((pos()) + newSizeInChunks), ((pos()) + (entrySizeInChunks())));
+ }
+ } else {
+ }
+ CompiledMapQueryContext.this.innerWriteLock.lock();
+ if (newValueSizeIsDifferent) {
+ initValueAgain(newValue);
+ } else {
+ writeValueGuarded(newValue);
+ }
+ CompiledMapQueryContext.this.putValueVolatile(CompiledMapQueryContext.this.hashLookupPos(), pos());
+ }
+
+ public void initEntryAndKey(long entrySize) {
+ initAllocatedChunks(CompiledMapQueryContext.this.h().inChunks(entrySize));
+ CompiledMapQueryContext.this.initEntry(CompiledMapQueryContext.this.alloc(allocatedChunks()), CompiledMapQueryContext.this.inputKey());
+ incrementSegmentEntriesIfNeeded();
+ }
+
+ void putEntry(Value value) {
+ assert CompiledMapQueryContext.this.searchStateAbsent();
+ long entrySize = CompiledMapQueryContext.this.entrySize(CompiledMapQueryContext.this.inputKey().size(), value.size());
+ CompiledMapQueryContext.this.initEntryAndKey(entrySize);
+ CompiledMapQueryContext.this.initValue(value);
+ CompiledMapQueryContext.this.freeExtraAllocatedChunks();
+ CompiledMapQueryContext.this.putNewVolatile(CompiledMapQueryContext.this.pos());
+ }
+
@Override
public void doInsert(Value value) {
- putPrefix();
- if (!(searchStatePresent())) {
- if (searchStateDeleted()) {
+ CompiledMapQueryContext.this.putPrefix();
+ if (!(CompiledMapQueryContext.this.searchStatePresent())) {
+ if (CompiledMapQueryContext.this.searchStateDeleted()) {
CompiledMapQueryContext.this.putValueDeletedEntry(value);
} else {
putEntry(value);
}
CompiledMapQueryContext.this.incrementModCountGuarded();
- setSearchStateGuarded(SearchState.PRESENT);
+ CompiledMapQueryContext.this.setSearchStateGuarded(SearchState.PRESENT);
} else {
throw new IllegalStateException("Entry is present in the map when doInsert() is called");
}
}
+
+ @Override
+ public void doReplaceValue(Value newValue) {
+ putPrefix();
+ if (searchStatePresent()) {
+ CompiledMapQueryContext.this.innerDefaultReplaceValue(newValue);
+ CompiledMapQueryContext.this.incrementModCountGuarded();
+ setSearchStateGuarded(SearchState.PRESENT);
+ } else {
+ throw new IllegalStateException("Entry is absent in the map when doReplaceValue() is called");
+ }
+ }
+
+ @Override
+ public void doRemove() {
+ CompiledMapQueryContext.this.checkOnEachPublicOperation();
+ CompiledMapQueryContext.this.innerUpdateLock.lock();
+ if (searchStatePresent()) {
+ CompiledMapQueryContext.this.innerWriteLock.lock();
+ CompiledMapQueryContext.this.remove();
+ CompiledMapQueryContext.this.innerRemoveEntryExceptHashLookupUpdate();
+ setSearchStateGuarded(SearchState.DELETED);
+ } else {
+ throw new IllegalStateException("Entry is absent when doRemove() is called");
+ }
+ }
}
diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java
index b76f02fa2..00e308a3f 100644
--- a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java
+++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java
@@ -47,19 +47,19 @@ import java.util.function.Predicate;
public class CompiledReplicatedMapIterationContext, V, VI, MVI extends MetaBytesInterop, R, T> implements AutoCloseable , HashEntry , InterProcessReadWriteUpdateLock , RemoteOperationContext , MapContext , MapEntry , IterationContextInterface , ReplicatedChronicleMapHolder , MapReplicableEntry {
public void close() {
- CompiledReplicatedMapIterationContext.this.closeReplicationUpdate();
- CompiledReplicatedMapIterationContext.this.closeHashLookupPos();
- CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue.closeValue();
- CompiledReplicatedMapIterationContext.this.closeAllocatedChunks();
- CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue.closeNext();
- CompiledReplicatedMapIterationContext.this.closeTheSegmentIndex();
- CompiledReplicatedMapIterationContext.this.closeEntryRemovedOnThisIteration();
CompiledReplicatedMapIterationContext.this.closeUsed();
+ CompiledReplicatedMapIterationContext.this.closeAllocatedChunks();
+ CompiledReplicatedMapIterationContext.this.closeReplicationUpdate();
+ CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue.closeValue();
+ CompiledReplicatedMapIterationContext.this.closeEntryRemovedOnThisIteration();
+ CompiledReplicatedMapIterationContext.this.closeTheSegmentIndex();
+ CompiledReplicatedMapIterationContext.this.closeHashLookupPos();
+ CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue.closeNext();
+ CompiledReplicatedMapIterationContext.this.closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants();
CompiledReplicatedMapIterationContext.this.closeReplicatedMapEntryStagesEntryBytesAccessOffsetDependants();
- CompiledReplicatedMapIterationContext.this.closeMapSegmentIterationCheckEntryNotRemovedOnThisIterationDependants();
CompiledReplicatedMapIterationContext.this.closeReplicatedChronicleMapHolderImplContextAtIndexInChainDependants();
CompiledReplicatedMapIterationContext.this.closeValueBytesInteropValueMetaInteropDependants();
- CompiledReplicatedMapIterationContext.this.closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants();
+ CompiledReplicatedMapIterationContext.this.closeReplicatedMapSegmentIterationCheckEntryNotRemovedOnThisIterationDependants();
}
public void incrementModCountGuarded() {
@@ -98,23 +98,24 @@ public class CompiledReplicatedMapIterationContext)(entryBytesAccessor.access(entryBytes)));
this.copies = ThreadLocalCopies.get();
this.valueInterop = CompiledReplicatedMapIterationContext.this.m().valueInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.m().originalValueInterop);
this.valueReader = CompiledReplicatedMapIterationContext.this.m().valueReaderProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.m().originalValueReader);
this.keyInterop = CompiledReplicatedMapIterationContext.this.h().keyInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.h().originalKeyInterop);
this.keyReader = CompiledReplicatedMapIterationContext.this.h().keyReaderProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.h().originalKeyReader);
- this.innerReadLock = new ReadLock();
- this.entryBytes = CompiledReplicatedMapIterationContext.this.h().ms.bytes();
- this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
- this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
- this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
- this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
this.entryValue = new EntryValueBytesValue();
- this.innerUpdateLock = new UpdateLock();
this.deprecatedMapKeyContextOnIteration = new DeprecatedMapKeyContextOnIteration();
- this.entryKey = new EntryKeyBytesValue();
+ this.owner = Thread.currentThread();
+ this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
this.innerWriteLock = new WriteLock();
+ this.dummyValue = new DummyValueZeroValue();
+ this.innerReadLock = new ReadLock();
+ this.innerUpdateLock = new UpdateLock();
}
public CompiledReplicatedMapIterationContext(CompiledReplicatedMapIterationContext c) {
@@ -122,23 +123,24 @@ public class CompiledReplicatedMapIterationContext)(c.m));
- this.owner = Thread.currentThread();
+ this.entryKey = new EntryKeyBytesValue();
+ this.entryBytes = CompiledReplicatedMapIterationContext.this.h().ms.bytes();
+ this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
+ this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
+ this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
this.copies = ThreadLocalCopies.get();
this.valueInterop = CompiledReplicatedMapIterationContext.this.m().valueInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.m().originalValueInterop);
this.valueReader = CompiledReplicatedMapIterationContext.this.m().valueReaderProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.m().originalValueReader);
this.keyInterop = CompiledReplicatedMapIterationContext.this.h().keyInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.h().originalKeyInterop);
this.keyReader = CompiledReplicatedMapIterationContext.this.h().keyReaderProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.h().originalKeyReader);
- this.innerReadLock = new ReadLock();
- this.entryBytes = CompiledReplicatedMapIterationContext.this.h().ms.bytes();
- this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
- this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
- this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
- this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
this.entryValue = new EntryValueBytesValue();
- this.innerUpdateLock = new UpdateLock();
this.deprecatedMapKeyContextOnIteration = new DeprecatedMapKeyContextOnIteration();
- this.entryKey = new EntryKeyBytesValue();
+ this.owner = Thread.currentThread();
+ this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
this.innerWriteLock = new WriteLock();
+ this.dummyValue = new DummyValueZeroValue();
+ this.innerReadLock = new ReadLock();
+ this.innerUpdateLock = new UpdateLock();
}
public class EntryKeyBytesValue extends AbstractValue {
@@ -154,6 +156,12 @@ public class CompiledReplicatedMapIterationContext {
@@ -505,12 +507,6 @@ public class CompiledReplicatedMapIterationContext {
- @Override
- public void close() {
- throw new UnsupportedOperationException("close() is not supported during iteration");
- }
-
- @NotNull
- @Override
- public K key() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.key().get();
- }
-
- @Override
- public boolean containsKey() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return true;
- }
-
- @Override
- public boolean valueEqualTo(V value) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return Value.bytesEquivalent(CompiledReplicatedMapIterationContext.this.entryValue, CompiledReplicatedMapIterationContext.this.context().wrapValueAsValue(value));
- }
-
- @Override
- public V getUsing(V usingValue) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.value().getUsing(usingValue);
- }
-
- @Override
- public V get() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.value().get();
- }
-
- @Override
- public boolean put(V newValue) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- CompiledReplicatedMapIterationContext.this.replaceValue(CompiledReplicatedMapIterationContext.this, CompiledReplicatedMapIterationContext.this.context().wrapValueAsValue(newValue));
- return true;
- }
-
- @Override
- public boolean remove() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- CompiledReplicatedMapIterationContext.this.remove(CompiledReplicatedMapIterationContext.this);
- return true;
- }
-
- @NotNull
- @Override
- public Bytes entry() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.entryBytes;
- }
-
@NotNull
private UnsupportedOperationException unsupportedLocks() {
return new UnsupportedOperationException("Lock operations are not supported (and not needed!) during iteration");
@@ -760,9 +705,60 @@ public class CompiledReplicatedMapIterationContext {
+ @Override
+ public Void handle() {
+ return null;
+ }
+
+ @Override
+ public ReadAccess access() {
+ return ReadAccess.zeros();
+ }
+
+ @Override
+ public V getUsing(V usingInstance) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public V get() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long size() {
+ return CompiledReplicatedMapIterationContext.this.m().valueSizeMarshaller.minEncodableSize();
+ }
+
+ @Override
+ public long offset() {
+ return 0;
+ }
+ }
+
private void _MapEntryStages_writeValue(Value, ?> value) {
value.writeTo(entryBytesAccess, entryBytesAccessHandle, entryBytesAccessOffset(valueOffset));
}
@@ -1003,6 +1037,12 @@ public class CompiledReplicatedMapIterationContext context() {
return CompiledReplicatedMapIterationContext.this;
}
+ public void checkEntryNotRemovedOnThisIteration() {
+ if (entryRemovedOnThisIterationInit())
+ throw new IllegalStateException("Entry was already removed on this iteration");
+
+ }
+
+ public void closeReplicatedMapSegmentIterationCheckEntryNotRemovedOnThisIterationDependants() {
+ CompiledReplicatedMapIterationContext.this.closeInterationCheckOnEachPublicOperationCheckOnEachPublicOperationDependants();
+ }
+
+ public MVI valueMetaInterop(V value) {
+ return CompiledReplicatedMapIterationContext.this.m().metaValueInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.m().originalMetaValueInterop, valueInterop, value);
+ }
+
+ public void closeValueBytesInteropValueMetaInteropDependants() {
+ CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue.closeBuffer();
+ }
+
+ public T contextAtIndexInChain(int index) {
+ return ((T)(contextChain.get(index)));
+ }
+
+ public void closeReplicatedChronicleMapHolderImplContextAtIndexInChainDependants() {
+ CompiledReplicatedMapIterationContext.this.closeSegmentStagesTryFindInitLocksOfThisSegmentDependants();
+ }
+
+ public void incrementSegmentEntriesIfNeeded() {
+ }
+
+ private long _MapEntryStages_sizeOfEverythingBeforeValue(long keySize, long valueSize) {
+ return (((CompiledReplicatedMapIterationContext.this.m().metaDataBytes) + (CompiledReplicatedMapIterationContext.this.m().keySizeMarshaller.sizeEncodingSize(keySize))) + keySize) + (CompiledReplicatedMapIterationContext.this.m().valueSizeMarshaller.sizeEncodingSize(valueSize));
+ }
+
+ long sizeOfEverythingBeforeValue(long keySize, long valueSize) {
+ return (_MapEntryStages_sizeOfEverythingBeforeValue(keySize, valueSize)) + (ReplicatedChronicleMap.ADDITIONAL_ENTRY_BYTES);
+ }
+
+ public final long entrySize(long keySize, long valueSize) {
+ long sizeOfEverythingBeforeValue = sizeOfEverythingBeforeValue(keySize, valueSize);
+ return innerEntrySize(sizeOfEverythingBeforeValue, valueSize);
+ }
+
+ public long entryBytesAccessOffset(long offset) {
+ return entryBytesAccessor.offset(entryBytes, offset);
+ }
+
+ public void closeReplicatedMapEntryStagesEntryBytesAccessOffsetDependants() {
+ CompiledReplicatedMapIterationContext.this.closeEntry();
+ }
+
public void checkAccessingFromOwnerThread() {
if ((owner) != (Thread.currentThread())) {
throw new ConcurrentModificationException("Context shouldn\'t be accessed from multiple threads");
@@ -1099,12 +1203,90 @@ public class CompiledReplicatedMapIterationContext wrapValueAsValue(V value) {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ WrappedValueInstanceValue wrapped = CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue;
+ wrapped = wrapped.getUnusedWrappedValueGuarded();
+ wrapped.initValue(value);
+ return wrapped;
+ }
+
+ @Override
+ public R remove(@NotNull
+ MapEntry entry) {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.m().entryOperations.remove(entry);
+ }
+
+ @Override
+ public R replaceValue(@NotNull
+ MapEntry entry, Value newValue) {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.m().entryOperations.replaceValue(entry, newValue);
+ }
+
+ @Override
+ public Value defaultValue(@NotNull
+ MapAbsentEntry absentEntry) {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.m().entryOperations.defaultValue(absentEntry);
+ }
+
+ @NotNull
+ @Override
+ public Value value() {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.entryValue;
+ }
+
+ @NotNull
+ @Override
+ public InterProcessLock readLock() {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.innerReadLock;
+ }
+
+ @NotNull
+ @Override
+ public InterProcessLock updateLock() {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.innerUpdateLock;
+ }
+
+ @NotNull
+ @Override
+ public Value key() {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.entryKey;
+ }
+
+ @Override
+ public R insert(@NotNull
+ MapAbsentEntry absentEntry, Value value) {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ return CompiledReplicatedMapIterationContext.this.m().entryOperations.insert(absentEntry, value);
}
private CompiledReplicatedMapIterationContext _Chaining_createChaining() {
@@ -1128,184 +1310,26 @@ public class CompiledReplicatedMapIterationContext= 0;
}
- public void incrementSegmentEntriesIfNeeded() {
+ public void initHashLookupPos(long hashLookupPos) {
+ this.hashLookupPos = hashLookupPos;
}
- public T contextAtIndexInChain(int index) {
- return ((T)(contextChain.get(index)));
+ public long hashLookupPos() {
+ assert this.hashLookupPosInit() : "HashLookupPos should be init";
+ return this.hashLookupPos;
}
- public void closeReplicatedChronicleMapHolderImplContextAtIndexInChainDependants() {
- CompiledReplicatedMapIterationContext.this.closeSegmentStagesTryFindInitLocksOfThisSegmentDependants();
- }
-
- public void checkEntryNotRemovedOnThisIteration() {
- if (entryRemovedOnThisIterationInit())
- throw new IllegalStateException("Entry was already removed on this iteration");
-
- }
-
- public void closeMapSegmentIterationCheckEntryNotRemovedOnThisIterationDependants() {
- CompiledReplicatedMapIterationContext.this.closeInterationCheckOnEachPublicOperationCheckOnEachPublicOperationDependants();
- }
-
- private void _CheckOnEachPublicOperation_checkOnEachPublicOperation() {
- CompiledReplicatedMapIterationContext.this.checkAccessingFromOwnerThread();
- }
-
- public void checkOnEachPublicOperation() {
- _CheckOnEachPublicOperation_checkOnEachPublicOperation();
- CompiledReplicatedMapIterationContext.this.checkEntryNotRemovedOnThisIteration();
- }
-
- public void closeInterationCheckOnEachPublicOperationCheckOnEachPublicOperationDependants() {
- CompiledReplicatedMapIterationContext.this.entryKey.closeEntryKeyBytesValueSizeDependants();
- CompiledReplicatedMapIterationContext.this.entryValue.closeEntryValueBytesValueSizeDependants();
- }
-
- @Override
- public Value defaultValue(@NotNull
- MapAbsentEntry absentEntry) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.m().entryOperations.defaultValue(absentEntry);
- }
-
- @Override
- public Value wrapValueAsValue(V value) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- WrappedValueInstanceValue wrapped = CompiledReplicatedMapIterationContext.this.wrappedValueInstanceValue;
- wrapped = wrapped.getUnusedWrappedValueGuarded();
- wrapped.initValue(value);
- return wrapped;
- }
-
- @NotNull
- @Override
- public InterProcessLock updateLock() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.innerUpdateLock;
- }
-
- @NotNull
- @Override
- public Value key() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.entryKey;
- }
-
- @Override
- public R replaceValue(@NotNull
- MapEntry entry, Value newValue) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.m().entryOperations.replaceValue(entry, newValue);
- }
-
- @Override
- public R remove(@NotNull
- MapEntry entry) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.m().entryOperations.remove(entry);
- }
-
- @NotNull
- @Override
- public InterProcessLock readLock() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.innerReadLock;
- }
-
- @Override
- public R insert(@NotNull
- MapAbsentEntry absentEntry, Value value) {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.m().entryOperations.insert(absentEntry, value);
- }
-
- @NotNull
- @Override
- public Value value() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.entryValue;
- }
-
- @NotNull
- @Override
- public InterProcessLock writeLock() {
- CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
- return CompiledReplicatedMapIterationContext.this.innerWriteLock;
- }
-
- public boolean entryIsPresent() {
- return true;
- }
-
- public long entryBytesAccessOffset(long offset) {
- return entryBytesAccessor.offset(entryBytes, offset);
- }
-
- public void closeReplicatedMapEntryStagesEntryBytesAccessOffsetDependants() {
- CompiledReplicatedMapIterationContext.this.closeEntry();
- }
-
- private long _MapEntryStages_sizeOfEverythingBeforeValue(long keySize, long valueSize) {
- return (((CompiledReplicatedMapIterationContext.this.m().metaDataBytes) + (CompiledReplicatedMapIterationContext.this.m().keySizeMarshaller.sizeEncodingSize(keySize))) + keySize) + (CompiledReplicatedMapIterationContext.this.m().valueSizeMarshaller.sizeEncodingSize(valueSize));
- }
-
- long sizeOfEverythingBeforeValue(long keySize, long valueSize) {
- return (_MapEntryStages_sizeOfEverythingBeforeValue(keySize, valueSize)) + (ReplicatedChronicleMap.ADDITIONAL_ENTRY_BYTES);
- }
-
- public final long entrySize(long keySize, long valueSize) {
- long sizeOfEverythingBeforeValue = sizeOfEverythingBeforeValue(keySize, valueSize);
- return innerEntrySize(sizeOfEverythingBeforeValue, valueSize);
- }
-
- public MKI keyMetaInterop(K key) {
- return CompiledReplicatedMapIterationContext.this.h().metaKeyInteropProvider.get(CompiledReplicatedMapIterationContext.this.copies, CompiledReplicatedMapIterationContext.this.h().originalMetaKeyInterop, keyInterop, key);
- }
-
- boolean used;
-
- public boolean usedInit() {
- return used;
- }
-
- public void initUsed(boolean used) {
- this.used = used;
- }
-
- void closeUsed() {
- if (!(this.usedInit()))
+ public void closeHashLookupPos() {
+ if (!(this.hashLookupPosInit()))
return ;
- used = false;
- }
-
- public boolean entryRemovedOnThisIteration = false;
-
- boolean entryRemovedOnThisIterationInit() {
- return (this.entryRemovedOnThisIteration) != false;
- }
-
- private void initEntryRemovedOnThisIteration(boolean entryRemovedOnThisIteration) {
- this.entryRemovedOnThisIteration = entryRemovedOnThisIteration;
- }
-
- public void closeEntryRemovedOnThisIteration() {
- if (!(this.entryRemovedOnThisIterationInit()))
- return ;
-
- this.entryRemovedOnThisIteration = false;
+ this.hashLookupPos = -1;
}
public int segmentIndex = -1;
@@ -1333,215 +1357,11 @@ public class CompiledReplicatedMapIterationContext= 0;
- }
-
- public void initSegmentHashLookup() {
- long hashLookupOffset = CompiledReplicatedMapIterationContext.this.h().segmentOffset(CompiledReplicatedMapIterationContext.this.segmentIndex());
- innerInitSegmentHashLookup(((CompiledReplicatedMapIterationContext.this.h().ms.address()) + hashLookupOffset), CompiledReplicatedMapIterationContext.this.h().segmentHashLookupCapacity, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupEntrySize, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupKeyBits, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupValueBits);
- }
-
- public void initSegmentHashLookup(long address, long capacity, int entrySize, int keyBits, int valueBits) {
- innerInitSegmentHashLookup(address, capacity, entrySize, keyBits, valueBits);
- }
-
- public int hashLookupEntrySize() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.hashLookupEntrySize;
- }
-
- public int keyBits() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.keyBits;
- }
-
- public long address() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.address;
- }
-
- public long capacityMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.capacityMask;
- }
-
- public long capacityMask2() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.capacityMask2;
- }
-
- public long entryMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.entryMask;
- }
-
- public long keyMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.keyMask;
- }
-
- public long valueMask() {
- if (!(this.segmentHashLookupInit()))
- this.initSegmentHashLookup();
-
- return this.valueMask;
- }
-
- public void closeSegmentHashLookup() {
- if (!(this.segmentHashLookupInit()))
- return ;
-
- this.address = -1;
- }
-
- public long stepBack(long pos) {
- return (pos -= hashLookupEntrySize()) >= 0 ? pos : capacityMask2();
- }
-
- public long step(long pos) {
- return (pos += hashLookupEntrySize()) <= (capacityMask2()) ? pos : 0L;
- }
-
- public long key(long entry) {
- return entry & (keyMask());
- }
-
- public boolean empty(long entry) {
- return (entry & (entryMask())) == (UNSET_ENTRY);
- }
-
- long indexToPos(long index) {
- return index * (hashLookupEntrySize());
- }
-
- public long maskUnsetKey(long key) {
- return (key &= keyMask()) != (UNSET_KEY) ? key : keyMask();
- }
-
- long entry(long key, long value) {
- return key | (value << (keyBits()));
- }
-
- public void writeEntryVolatile(long pos, long prevEntry, long key, long value) {
- long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
- NativeBytes.UNSAFE.putLongVolatile(null, ((address()) + pos), entry);
- }
-
- public void writeEntry(long pos, long prevEntry, long key, long value) {
- long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
- void writeEntry(long pos, long prevEntry, long anotherEntry) {
- long entry = (prevEntry & (~(entryMask()))) | (anotherEntry & (entryMask()));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
- public void clearHashLookup() {
- NativeBytes.UNSAFE.setMemory(address(), ((capacityMask2()) + (hashLookupEntrySize())), ((byte)(0)));
- }
-
- public long hlPos(long key) {
- return indexToPos((key & (capacityMask())));
- }
-
- public void checkValueForPut(long value) {
- assert (value & (~(valueMask()))) == 0L : "Value out of range, was " + value;
- }
-
- public long readEntry(long pos) {
- return NativeBytes.UNSAFE.getLong(((address()) + pos));
- }
-
- public void putValueVolatile(long pos, long value) {
- checkValueForPut(value);
- long currentEntry = readEntry(pos);
- writeEntryVolatile(pos, currentEntry, key(currentEntry), value);
- }
-
- void clearEntry(long pos, long prevEntry) {
- long entry = prevEntry & (~(entryMask()));
- NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
- }
-
- public long remove(long posToRemove) {
- long entryToRemove = readEntry(posToRemove);
- long posToShift = posToRemove;
- while (true) {
- posToShift = step(posToShift);
- long entryToShift = readEntry(posToShift);
- if (empty(entryToShift))
- break;
-
- long insertPos = hlPos(key(entryToShift));
- boolean cond1 = insertPos <= posToRemove;
- boolean cond2 = posToRemove <= posToShift;
- if ((cond1 && cond2) || ((posToShift < insertPos) && (cond1 || cond2))) {
- writeEntry(posToRemove, entryToRemove, entryToShift);
- posToRemove = posToShift;
- entryToRemove = entryToShift;
- }
- }
- clearEntry(posToRemove, entryToRemove);
- return posToRemove;
- }
-
- public long value(long entry) {
- return (entry >>> (keyBits())) & (valueMask());
- }
-
- void forEach(EntryConsumer action) {
- for (long pos = 0L ; pos <= (capacityMask2()) ; pos += hashLookupEntrySize()) {
- long entry = readEntry(pos);
- if (!(empty(entry)))
- action.accept(key(entry), value(entry));
-
- }
- }
-
- String hashLookupToString() {
- final StringBuilder sb = new StringBuilder("{");
- forEach((long key,long value) -> sb.append(key).append('=').append(value).append(','));
- sb.append('}');
- return sb.toString();
}
long entrySpaceOffset = 0;
@@ -1662,19 +1482,11 @@ public class CompiledReplicatedMapIterationContext= 0;
+ }
+
+ public void initSegmentHashLookup() {
+ long hashLookupOffset = CompiledReplicatedMapIterationContext.this.h().segmentOffset(CompiledReplicatedMapIterationContext.this.segmentIndex());
+ innerInitSegmentHashLookup(((CompiledReplicatedMapIterationContext.this.h().ms.address()) + hashLookupOffset), CompiledReplicatedMapIterationContext.this.h().segmentHashLookupCapacity, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupEntrySize, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupKeyBits, CompiledReplicatedMapIterationContext.this.h().segmentHashLookupValueBits);
+ }
+
+ public void initSegmentHashLookup(long address, long capacity, int entrySize, int keyBits, int valueBits) {
+ innerInitSegmentHashLookup(address, capacity, entrySize, keyBits, valueBits);
+ }
+
+ public int hashLookupEntrySize() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.hashLookupEntrySize;
+ }
+
+ public int keyBits() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.keyBits;
+ }
+
+ public long address() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.address;
+ }
+
+ public long capacityMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.capacityMask;
+ }
+
+ public long capacityMask2() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.capacityMask2;
+ }
+
+ public long entryMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.entryMask;
+ }
+
+ public long keyMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.keyMask;
+ }
+
+ public long valueMask() {
+ if (!(this.segmentHashLookupInit()))
+ this.initSegmentHashLookup();
+
+ return this.valueMask;
+ }
+
+ public void closeSegmentHashLookup() {
+ if (!(this.segmentHashLookupInit()))
+ return ;
+
+ this.address = -1;
+ }
+
+ public void checkValueForPut(long value) {
+ assert (value & (~(valueMask()))) == 0L : "Value out of range, was " + value;
+ }
+
+ long indexToPos(long index) {
+ return index * (hashLookupEntrySize());
+ }
+
+ public long key(long entry) {
+ return entry & (keyMask());
+ }
+
+ public long value(long entry) {
+ return (entry >>> (keyBits())) & (valueMask());
+ }
+
+ public boolean empty(long entry) {
+ return (entry & (entryMask())) == (UNSET_ENTRY);
+ }
+
+ public long maskUnsetKey(long key) {
+ return (key &= keyMask()) != (UNSET_KEY) ? key : keyMask();
+ }
+
+ long entry(long key, long value) {
+ return key | (value << (keyBits()));
+ }
+
+ public void writeEntry(long pos, long prevEntry, long key, long value) {
+ long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ public void writeEntryVolatile(long pos, long prevEntry, long key, long value) {
+ long entry = (prevEntry & (~(entryMask()))) | (entry(key, value));
+ NativeBytes.UNSAFE.putLongVolatile(null, ((address()) + pos), entry);
+ }
+
+ void clearEntry(long pos, long prevEntry) {
+ long entry = prevEntry & (~(entryMask()));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ void writeEntry(long pos, long prevEntry, long anotherEntry) {
+ long entry = (prevEntry & (~(entryMask()))) | (anotherEntry & (entryMask()));
+ NativeBytes.UNSAFE.putLong(((address()) + pos), entry);
+ }
+
+ public long readEntry(long pos) {
+ return NativeBytes.UNSAFE.getLong(((address()) + pos));
+ }
+
+ public void putValueVolatile(long pos, long value) {
+ checkValueForPut(value);
+ long currentEntry = readEntry(pos);
+ writeEntryVolatile(pos, currentEntry, key(currentEntry), value);
+ }
+
+ void forEach(EntryConsumer action) {
+ for (long pos = 0L ; pos <= (capacityMask2()) ; pos += hashLookupEntrySize()) {
+ long entry = readEntry(pos);
+ if (!(empty(entry)))
+ action.accept(key(entry), value(entry));
+
+ }
+ }
+
+ String hashLookupToString() {
+ final StringBuilder sb = new StringBuilder("{");
+ forEach((long key,long value) -> sb.append(key).append('=').append(value).append(','));
+ sb.append('}');
+ return sb.toString();
+ }
+
+ public long step(long pos) {
+ return (pos += hashLookupEntrySize()) <= (capacityMask2()) ? pos : 0L;
+ }
+
+ public void clearHashLookup() {
+ NativeBytes.UNSAFE.setMemory(address(), ((capacityMask2()) + (hashLookupEntrySize())), ((byte)(0)));
+ }
+
+ public long hlPos(long key) {
+ return indexToPos((key & (capacityMask())));
+ }
+
+ public long remove(long posToRemove) {
+ long entryToRemove = readEntry(posToRemove);
+ long posToShift = posToRemove;
+ while (true) {
+ posToShift = step(posToShift);
+ long entryToShift = readEntry(posToShift);
+ if (empty(entryToShift))
+ break;
+
+ long insertPos = hlPos(key(entryToShift));
+ boolean cond1 = insertPos <= posToRemove;
+ boolean cond2 = posToRemove <= posToShift;
+ if ((cond1 && cond2) || ((posToShift < insertPos) && (cond1 || cond2))) {
+ writeEntry(posToRemove, entryToRemove, entryToShift);
+ posToRemove = posToShift;
+ entryToRemove = entryToShift;
+ }
+ }
+ clearEntry(posToRemove, entryToRemove);
+ return posToRemove;
+ }
+
+ public long stepBack(long pos) {
+ return (pos -= hashLookupEntrySize()) >= 0 ? pos : capacityMask2();
+ }
+
long segmentHeaderAddress;
SegmentHeader segmentHeader = null;
@@ -1815,10 +1839,30 @@ public class CompiledReplicatedMapIterationContext= (CompiledReplicatedMapIterationContext.this.h().actualChunksPerSegment))
- nextPosToSearchFrom = 0L;
-
- nextPosToSearchFrom(nextPosToSearchFrom);
- }
-
- public long alloc(int chunks) {
- VanillaChronicleHash, ?, ?, ?, ?> h = CompiledReplicatedMapIterationContext.this.h();
- if (chunks > (h.maxChunksPerEntry))
- throw new IllegalArgumentException((((("Entry is too large: requires " + chunks) + " entry size chucks, ") + (h.maxChunksPerEntry)) + " is maximum."));
-
- long ret = freeList().setNextNContinuousClearBits(nextPosToSearchFrom(), chunks);
- if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
- if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
- freeList().clear(ret, h.actualChunksPerSegment);
-
- ret = freeList().setNextNContinuousClearBits(0L, chunks);
- if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
- if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
- freeList().clear(ret, h.actualChunksPerSegment);
-
- if (chunks == 1) {
- throw new IllegalStateException("Segment is full, no free entries found");
- } else {
- throw new IllegalStateException((("Segment is full or has no ranges of " + chunks) + " continuous free chunks"));
- }
- }
- updateNextPosToSearchFrom(ret, chunks);
- } else {
- if ((chunks == 1) || (freeList().isSet(nextPosToSearchFrom()))) {
- updateNextPosToSearchFrom(ret, chunks);
- }
- }
- return ret;
- }
-
- public void free(long fromPos, int chunks) {
- freeList().clear(fromPos, (fromPos + chunks));
- if (fromPos < (nextPosToSearchFrom()))
- nextPosToSearchFrom(fromPos);
-
- }
-
int totalReadLockCount;
int totalUpdateLockCount;
@@ -1973,75 +1948,13 @@ public class CompiledReplicatedMapIterationContext= 0;
- }
-
- public void initHashLookupPos(long hashLookupPos) {
- this.hashLookupPos = hashLookupPos;
- }
-
- public long hashLookupPos() {
- assert this.hashLookupPosInit() : "HashLookupPos should be init";
- return this.hashLookupPos;
- }
-
- public void closeHashLookupPos() {
- if (!(this.hashLookupPosInit()))
- return ;
-
- this.hashLookupPos = -1;
- }
-
public boolean forEachRemoving(Predicate super MapEntry> action) {
CompiledReplicatedMapIterationContext.this.innerUpdateLock.lock();
- long size = CompiledReplicatedMapIterationContext.this.size();
- if (size == 0)
- return true;
-
try {
+ long size = CompiledReplicatedMapIterationContext.this.size();
+ if (size == 0)
+ return true;
+
boolean interrupted = false;
long startPos = 0L;
while (!(CompiledReplicatedMapIterationContext.this.empty(CompiledReplicatedMapIterationContext.this.readEntry(startPos)))) {
@@ -2073,6 +1986,92 @@ public class CompiledReplicatedMapIterationContext= (CompiledReplicatedMapIterationContext.this.h().actualChunksPerSegment))
+ nextPosToSearchFrom = 0L;
+
+ nextPosToSearchFrom(nextPosToSearchFrom);
+ }
+
+ public long alloc(int chunks) {
+ VanillaChronicleHash, ?, ?, ?, ?> h = CompiledReplicatedMapIterationContext.this.h();
+ if (chunks > (h.maxChunksPerEntry))
+ throw new IllegalArgumentException((((("Entry is too large: requires " + chunks) + " entry size chucks, ") + (h.maxChunksPerEntry)) + " is maximum."));
+
+ long ret = freeList().setNextNContinuousClearBits(nextPosToSearchFrom(), chunks);
+ if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
+ if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
+ freeList().clear(ret, h.actualChunksPerSegment);
+
+ ret = freeList().setNextNContinuousClearBits(0L, chunks);
+ if ((ret == (DirectBitSet.NOT_FOUND)) || ((ret + chunks) > (h.actualChunksPerSegment))) {
+ if (((ret != (DirectBitSet.NOT_FOUND)) && ((ret + chunks) > (h.actualChunksPerSegment))) && (ret < (h.actualChunksPerSegment)))
+ freeList().clear(ret, h.actualChunksPerSegment);
+
+ if (chunks == 1) {
+ throw new IllegalStateException("Segment is full, no free entries found");
+ } else {
+ throw new IllegalStateException((("Segment is full or has no ranges of " + chunks) + " continuous free chunks"));
+ }
+ }
+ updateNextPosToSearchFrom(ret, chunks);
+ } else {
+ if ((chunks == 1) || (freeList().isSet(nextPosToSearchFrom()))) {
+ updateNextPosToSearchFrom(ret, chunks);
+ }
+ }
+ return ret;
+ }
+
+ public void free(long fromPos, int chunks) {
+ freeList().clear(fromPos, (fromPos + chunks));
+ if (fromPos < (nextPosToSearchFrom()))
+ nextPosToSearchFrom(fromPos);
+
+ }
+
+ public void dropChange() {
+ CompiledReplicatedMapIterationContext.this.m().dropChange(CompiledReplicatedMapIterationContext.this.segmentIndex(), CompiledReplicatedMapIterationContext.this.pos());
+ }
+
+ public void closeReplicationUpdateDropChangeDependants() {
+ CompiledReplicatedMapIterationContext.this.closeReplicationUpdateUpdateChangeDependants();
+ }
+
+ public boolean entryRemovedOnThisIteration = false;
+
+ boolean entryRemovedOnThisIterationInit() {
+ return (this.entryRemovedOnThisIteration) != false;
+ }
+
+ protected void initEntryRemovedOnThisIteration(boolean entryRemovedOnThisIteration) {
+ this.entryRemovedOnThisIteration = entryRemovedOnThisIteration;
+ }
+
+ public void closeEntryRemovedOnThisIteration() {
+ if (!(this.entryRemovedOnThisIterationInit()))
+ return ;
+
+ this.entryRemovedOnThisIteration = false;
+ }
+
public long newTimestamp;
public byte newIdentifier = ((byte)(0));
@@ -2125,8 +2124,14 @@ public class CompiledReplicatedMapIterationContext value) {
+ initValue(value);
+ freeExtraAllocatedChunks();
+ CompiledReplicatedMapIterationContext.this.putValueVolatile(CompiledReplicatedMapIterationContext.this.hashLookupPos(), pos());
+ }
+
+ public void initEntryAndKeyCopying(long entrySize, long bytesToCopy) {
+ initAllocatedChunks(CompiledReplicatedMapIterationContext.this.h().inChunks(entrySize));
+ CompiledReplicatedMapIterationContext.this.initEntryCopying(CompiledReplicatedMapIterationContext.this.alloc(allocatedChunks()), bytesToCopy);
+ incrementSegmentEntriesIfNeeded();
+ }
+
private void _MapEntryStages_putValueDeletedEntry(Value newValue) {
assert CompiledReplicatedMapIterationContext.this.innerUpdateLock.isHeldByCurrentThread();
int newSizeInChunks;
@@ -2339,12 +2411,6 @@ public class CompiledReplicatedMapIterationContext value) {
- initValue(value);
- freeExtraAllocatedChunks();
- CompiledReplicatedMapIterationContext.this.putValueVolatile(CompiledReplicatedMapIterationContext.this.hashLookupPos(), pos());
- }
-
private void _MapEntryStages_relocation(Value newValue, long newSizeOfEverythingBeforeValue) {
CompiledReplicatedMapIterationContext.this.free(pos(), entrySizeInChunks());
long entrySize = innerEntrySize(newSizeOfEverythingBeforeValue, newValue.size());
@@ -2357,27 +2423,6 @@ public class CompiledReplicatedMapIterationContext newValue) {
assert CompiledReplicatedMapIterationContext.this.innerUpdateLock.isHeldByCurrentThread();
boolean newValueSizeIsDifferent = (newValue.size()) != (this.valueSize());
@@ -2412,8 +2457,38 @@ public class CompiledReplicatedMapIterationContext newValue) {
+ public void doRemove() {
+ CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
+ initEntryRemovedOnThisIteration(true);
+ try {
+ if ((CompiledReplicatedMapIterationContext.this.valueSize()) > (CompiledReplicatedMapIterationContext.this.dummyValue.size()))
+ CompiledReplicatedMapIterationContext.this.innerDefaultReplaceValue(CompiledReplicatedMapIterationContext.this.dummyValue);
+
+ CompiledReplicatedMapIterationContext.this.initUpdatedReplicationState();
+ CompiledReplicatedMapIterationContext.this.writeEntryDeleted();
+ CompiledReplicatedMapIterationContext.this.updateChange();
+ CompiledReplicatedMapIterationContext.this.deleted(((CompiledReplicatedMapIterationContext.this.deleted()) + 1));
+ } finally {
+ CompiledReplicatedMapIterationContext.this.innerWriteLock.unlock();
+ }
+ }
+
+ private void _MapSegmentIteration_doReplaceValue(Value newValue) {
CompiledReplicatedMapIterationContext.this.checkOnEachPublicOperation();
try {
CompiledReplicatedMapIterationContext.this.innerDefaultReplaceValue(newValue);
@@ -2423,35 +2498,24 @@ public class CompiledReplicatedMapIterationContext newValue) {
+ _MapSegmentIteration_doReplaceValue(newValue);
}
- private boolean updatedReplicationState = false;
+ boolean used;
- public boolean updatedReplicationStateInit() {
- return (this.updatedReplicationState) != false;
+ public boolean usedInit() {
+ return used;
}
- public void initUpdatedReplicationState() {
- initReplicationState(CompiledReplicatedMapIterationContext.this.newTimestamp(), CompiledReplicatedMapIterationContext.this.newIdentifier());
- updatedReplicationState = true;
+ public void initUsed(boolean used) {
+ this.used = used;
}
- public void closeUpdatedReplicationState() {
- if (!(this.updatedReplicationStateInit()))
+ void closeUsed() {
+ if (!(this.usedInit()))
return ;
- this.updatedReplicationState = false;
- }
-
- private boolean testTimeStampInSensibleRange() {
- if ((CompiledReplicatedMapIterationContext.this.m().timeProvider) == (TimeProvider.SYSTEM)) {
- long currentTime = TimeProvider.SYSTEM.currentTime();
- assert (Math.abs((currentTime - (timestamp())))) <= 100000000 : "unrealistic timestamp: " + (timestamp());
- assert (Math.abs((currentTime - (CompiledReplicatedMapIterationContext.this.newTimestamp())))) <= 100000000 : "unrealistic newTimestamp: " + (CompiledReplicatedMapIterationContext.this.newTimestamp());
- }
- return true;
+ used = false;
}
}
diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java
index c300f0196..02b722fb5 100644
--- a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java
+++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java
@@ -19,8 +19,10 @@ import net.openhft.chronicle.hash.replication.TimeProvider;
import net.openhft.chronicle.hash.serialization.BytesReader;
import net.openhft.chronicle.hash.serialization.internal.MetaBytesInterop;
import net.openhft.chronicle.map.*;
+import net.openhft.chronicle.map.TcpReplicator.TcpSocketChannelEntryWriter;
import net.openhft.chronicle.map.impl.ret.InstanceReturnValue;
import net.openhft.chronicle.map.impl.ret.UsableReturnValue;
+import net.openhft.chronicle.map.impl.stage.query.MapAbsentEntryHolder;
import net.openhft.chronicle.map.impl.value.instance.ValueInitableValue;
import net.openhft.chronicle.map.replication.MapRemoteQueryContext;
import net.openhft.chronicle.map.replication.MapReplicableEntry;
@@ -43,23 +45,24 @@ import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.concurrent.TimeUnit;
-public class CompiledReplicatedMapQueryContext, V, VI, MVI extends MetaBytesInterop, R, T> implements AutoCloseable , HashEntry , InterProcessReadWriteUpdateLock , RemoteOperationContext , ExternalMapQueryContext , MapAbsentEntry , MapContext , MapEntry , QueryContextInterface , ReplicatedChronicleMapHolder , MapRemoteQueryContext , MapReplicableEntry {
+public class CompiledReplicatedMapQueryContext, V, VI, MVI extends MetaBytesInterop, R, T> implements AutoCloseable , HashEntry , InterProcessReadWriteUpdateLock , RemoteOperationContext , ExternalMapQueryContext , MapAbsentEntry , MapContext , MapEntry , QueryContextInterface , ReplicatedChronicleMapHolder , MapAbsentEntryHolder , MapRemoteQueryContext , MapReplicableEntry {
public void close() {
+ CompiledReplicatedMapQueryContext.this.closeAllocatedChunks();
+ CompiledReplicatedMapQueryContext.this.closeReplicatedInputBytes();
CompiledReplicatedMapQueryContext.this.closeReplicationUpdate();
- CompiledReplicatedMapQueryContext.this.closeInputKey();
- CompiledReplicatedMapQueryContext.this.wrappedValueInstanceValue.closeValue();
+ CompiledReplicatedMapQueryContext.this.closeReplicationInput();
+ CompiledReplicatedMapQueryContext.this.defaultReturnValue.closeDefaultReturnedValue();
+ CompiledReplicatedMapQueryContext.this.inputValueInstanceValue.closeValue();
CompiledReplicatedMapQueryContext.this.wrappedValueInstanceValue.closeNext();
CompiledReplicatedMapQueryContext.this.closeUsed();
- CompiledReplicatedMapQueryContext.this.closeAllocatedChunks();
- CompiledReplicatedMapQueryContext.this.closeInputBytes();
- CompiledReplicatedMapQueryContext.this.closeReplicatedInputBytes();
- CompiledReplicatedMapQueryContext.this.usingReturnValue.closeUsingReturnValue();
+ CompiledReplicatedMapQueryContext.this.closeInputKey();
CompiledReplicatedMapQueryContext.this.inputKeyInstanceValue.closeKey();
- CompiledReplicatedMapQueryContext.this.inputValueInstanceValue.closeValue();
- CompiledReplicatedMapQueryContext.this.defaultReturnValue.closeDefaultReturnedValue();
- CompiledReplicatedMapQueryContext.this.closeKeyBytesInteropKeyMetaInteropDependants();
- CompiledReplicatedMapQueryContext.this.innerUpdateLock.closeUpdateLockForbiddenUpgradeDependants();
+ CompiledReplicatedMapQueryContext.this.bytesReturnValue.closeOutput();
+ CompiledReplicatedMapQueryContext.this.wrappedValueInstanceValue.closeValue();
+ CompiledReplicatedMapQueryContext.this.closeInputBytes();
+ CompiledReplicatedMapQueryContext.this.usingReturnValue.closeUsingReturnValue();
CompiledReplicatedMapQueryContext.this.closeValueBytesInteropValueMetaInteropDependants();
+ CompiledReplicatedMapQueryContext.this.closeKeyBytesInteropKeyMetaInteropDependants();
CompiledReplicatedMapQueryContext.this.closeReplicatedChronicleMapHolderImplContextAtIndexInChainDependants();
CompiledReplicatedMapQueryContext.this.closeOwnerThreadHolderCheckAccessingFromOwnerThreadDependants();
CompiledReplicatedMapQueryContext.this.closeReplicatedMapEntryStagesEntryBytesAccessOffsetDependants();
@@ -114,34 +117,36 @@ public class CompiledReplicatedMapQueryContext)(entryBytesAccessor.access(entryBytes)));
+ this.bytesReturnValue = new BytesReturnValue();
+ this.innerWriteLock = new WriteLock();
+ this.replicatedInputKeyBytesValue = new ReplicatedInputKeyBytesValue();
+ this.inputFirstValueBytesValue = new InputFirstValueBytesValue();
this.copies = ThreadLocalCopies.get();
this.valueInterop = CompiledReplicatedMapQueryContext.this.m().valueInteropProvider.get(CompiledReplicatedMapQueryContext.this.copies, CompiledReplicatedMapQueryContext.this.m().originalValueInterop);
this.valueReader = CompiledReplicatedMapQueryContext.this.m().valueReaderProvider.get(CompiledReplicatedMapQueryContext.this.copies, CompiledReplicatedMapQueryContext.this.m().originalValueReader);
this.keyInterop = CompiledReplicatedMapQueryContext.this.h().keyInteropProvider.get(CompiledReplicatedMapQueryContext.this.copies, CompiledReplicatedMapQueryContext.this.h().originalKeyInterop);
this.keyReader = CompiledReplicatedMapQueryContext.this.h().keyReaderProvider.get(CompiledReplicatedMapQueryContext.this.copies, CompiledReplicatedMapQueryContext.this.h().originalKeyReader);
- this.defaultReturnValue = new DefaultReturnValue();
- this.innerUpdateLock = new UpdateLock();
- this.owner = Thread.currentThread();
+ this.absentDelegating = new ReplicatedMapAbsentDelegating();
this.inputKeyInstanceValue = new InputKeyInstanceValue();
+ this.usingReturnValue = new UsingReturnValue();
+ this.defaultReturnValue = new DefaultReturnValue();
+ this.inputKeyBytesValue = new InputKeyBytesValue();
+ this.inputSecondValueBytesValue = new InputSecondValueBytesValue();
+ this.innerReadLock = new ReadLock();
+ this.deprecatedMapAcquireContext = new DeprecatedMapAcquireContextOnQuery();
+ this.entryKey = new EntryKeyBytesValue();
+ this.replicatedInputValueBytesValue = new ReplicatedInputValueBytesValue();
this.wrappedValueInstanceValue = new WrappedValueInstanceValue();
- this.entryBytes = CompiledReplicatedMapQueryContext.this.h().ms.bytes();
- this.entryBytesAccessor = JavaLangBytesAccessors.uncheckedBytesAccessor(entryBytes);
- this.entryBytesAccessHandle = ((T)(entryBytesAccessor.handle(entryBytes)));
- this.entryBytesAccess = ((Access)(entryBytesAccessor.access(entryBytes)));
- this.innerWriteLock = new WriteLock();
+ this.owner = Thread.currentThread();
+ this.entryValue = new EntryValueBytesValue();
+ this.dummyValue = new DummyValueZeroValue();
}
public CompiledReplicatedMapQueryContext(CompiledReplicatedMapQueryContext c) {
@@ -149,42 +154,39 @@ public class CompiledReplicatedMapQueryContext