mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Update lang to the latest version
This commit is contained in:
@@ -143,6 +143,8 @@ abstract class AbstractChronicleMapBuilder<K, V,
|
||||
private SingleChronicleHashReplication singleHashReplication = null;
|
||||
private InetSocketAddress[] pushToAddresses;
|
||||
public boolean bootstrapOnlyLocalEntries = false;
|
||||
private boolean checkSerializedValues = false;
|
||||
private boolean disableOversizedEntries = false;
|
||||
|
||||
AbstractChronicleMapBuilder(Class<K> keyClass, Class<V> valueClass) {
|
||||
keyBuilder = new SerializationBuilder<K>(keyClass, SerializationBuilder.Role.KEY);
|
||||
@@ -1003,5 +1005,17 @@ abstract class AbstractChronicleMapBuilder<K, V,
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChronicleMapBuilderI<K, V> checkSerializedValues() {
|
||||
this.checkSerializedValues = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChronicleMapBuilderI<K, V> disableOversizedEntries() {
|
||||
this.disableOversizedEntries = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -541,13 +541,12 @@ public final class ChronicleMapBuilder<K, V> implements ChronicleMapBuilderI<K,
|
||||
}
|
||||
|
||||
public ChronicleMapBuilderI<K, V> checkSerializedValues() {
|
||||
// throw new UnsupportedOperationException("Not implemented");
|
||||
delegate.checkSerializedValues();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChronicleMapBuilder<K, V> disableOversizedEntries(boolean disableOversizedEntries) {
|
||||
// throw an exception rather than use oversized entries to test the size is as expected.
|
||||
// throw new UnsupportedOperationException("Not implemented");
|
||||
public ChronicleMapBuilder<K, V> disableOversizedEntries() {
|
||||
delegate.disableOversizedEntries();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,4 +315,7 @@ public interface ChronicleMapBuilderI<K, V> extends Serializable {
|
||||
|
||||
String name();
|
||||
|
||||
ChronicleMapBuilderI<K, V> checkSerializedValues();
|
||||
|
||||
ChronicleMapBuilderI<K, V> disableOversizedEntries();
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
|
||||
private volatile ByteBuffer outBuffer;
|
||||
private volatile ByteBufferBytes outBytes;
|
||||
|
||||
private ByteBuffer inBuffer;
|
||||
private ByteBufferBytes inBytes;
|
||||
private volatile ByteBuffer inBuffer;
|
||||
private volatile ByteBufferBytes inBytes;
|
||||
|
||||
@NotNull
|
||||
private final ReaderWithSize<K> keyReaderWithSize;
|
||||
@@ -331,13 +331,14 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
|
||||
* @return a unique transactionId
|
||||
*/
|
||||
private long nextUniqueTransaction(long time) {
|
||||
long old = transactionID.getAndSet(time);
|
||||
|
||||
if (old == time)
|
||||
return transactionID.incrementAndGet();
|
||||
else
|
||||
return time;
|
||||
|
||||
long id = time * 1000;
|
||||
for (; ; ) {
|
||||
long old = transactionID.get();
|
||||
if (old > id) id = old + 1;
|
||||
if (transactionID.compareAndSet(old, id))
|
||||
break;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -997,13 +998,15 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
|
||||
receive(SIZE_OF_SIZE + SIZE_OF_TRANSACTION_ID, timeoutTime);
|
||||
|
||||
final int messageSize = inBytes.readInt();
|
||||
assert messageSize > 0 : "Invalid message size " + messageSize;
|
||||
assert messageSize < 16 << 20 : "Invalid message size " + messageSize;
|
||||
|
||||
final int remainingBytes0 = messageSize - (SIZE_OF_SIZE + SIZE_OF_TRANSACTION_ID);
|
||||
final long transactionId0 = inBytes.readLong();
|
||||
|
||||
assert transactionId0 != 0;
|
||||
|
||||
// check the transaction id is reasonable
|
||||
assert String.valueOf(transactionId0).startsWith("14");
|
||||
assert transactionId0 > 1410000000000000L : "TransactionId too small " + transactionId0 + " messageSize " + messageSize;
|
||||
assert transactionId0 < 2100000000000000L : "TransactionId too large " + transactionId0 + " messageSize " + messageSize;
|
||||
|
||||
// if the transaction id is for this thread process it
|
||||
if (transactionId0 == transactionId) {
|
||||
|
||||
Reference in New Issue
Block a user