mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
package net.openhft.chronicle.hash;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class ChronicleHashErrorListeners {
|
||||
@@ -39,21 +38,20 @@ public final class ChronicleHashErrorListeners {
|
||||
|
||||
private static enum LoggingErrorListener implements ChronicleHashErrorListener {
|
||||
INSTANCE;
|
||||
final Logger LOG = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public void onLockTimeout(long threadId) throws IllegalStateException {
|
||||
if (threadId > 1L << 32) {
|
||||
LOG.warn("Grabbing lock held by processId: {}, threadId: {}",
|
||||
LoggerFactory.getLogger(getClass()).warn("Grabbing lock held by processId: {}, threadId: {}",
|
||||
(threadId >>> 33), (threadId & 0xFFFFFFL));
|
||||
} else {
|
||||
LOG.warn("Grabbing lock held by threadId: {}", threadId);
|
||||
LoggerFactory.getLogger(getClass()).warn("Grabbing lock held by threadId: {}", threadId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void errorOnUnlock(IllegalMonitorStateException e) {
|
||||
LOG.warn("Failed to unlock as expected", e);
|
||||
LoggerFactory.getLogger(getClass()).warn("Failed to unlock as expected", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package net.openhft.chronicle.hash.serialization;
|
||||
|
||||
import net.openhft.lang.Maths;
|
||||
import net.openhft.lang.io.Bytes;
|
||||
import net.openhft.lang.io.NativeBytes;
|
||||
import sun.misc.Unsafe;
|
||||
@@ -28,9 +29,9 @@ import static java.nio.ByteOrder.nativeOrder;
|
||||
public enum Hasher {
|
||||
;
|
||||
|
||||
private static final long LONG_LEVEL_PRIME_MULTIPLE = 1011001110001111L;
|
||||
private static final short SHORT_LEVEL_PRIME_MULTIPLE = 10191;
|
||||
private static final byte BYTE_LEVEL_PRIME_MULTIPLE = 109;
|
||||
private static final long LONG_LEVEL_PRIME_MULTIPLE = 0x9ddfea08eb382d69L;
|
||||
private static final short SHORT_LEVEL_PRIME_MULTIPLE = 0x404f;
|
||||
private static final byte BYTE_LEVEL_PRIME_MULTIPLE = 0x57;
|
||||
|
||||
private static final int INT_HASH_LOW_SHORT_MULTIPLE =
|
||||
nativeOrder() == LITTLE_ENDIAN ? SHORT_LEVEL_PRIME_MULTIPLE : 1;
|
||||
@@ -75,8 +76,6 @@ public enum Hasher {
|
||||
}
|
||||
|
||||
public static long hash(long value) {
|
||||
value ^= (value >>> 41) - (value >>> 21);
|
||||
value ^= (value >>> 15) + (value >>> 7);
|
||||
return value;
|
||||
return Maths.hash(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1887,15 +1887,7 @@ class KeyValueSerializer<K, V> {
|
||||
|
||||
|
||||
private boolean nullCheck(Bytes in) {
|
||||
try {
|
||||
return in.readBoolean();
|
||||
} catch (BufferUnderflowException e) {
|
||||
|
||||
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return in.readBoolean();
|
||||
}
|
||||
|
||||
K readKey(Bytes reader) {
|
||||
|
||||
@@ -51,7 +51,6 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, KI>,
|
||||
V, VW, MVW extends MetaBytesWriter<V, VW>> extends AbstractMap<K, V>
|
||||
implements ChronicleMap<K, V>, Serializable {
|
||||
private static final long serialVersionUID = 2L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VanillaChronicleMap.class);
|
||||
|
||||
/**
|
||||
* Because DirectBitSet implementations couldn't find more than 64 continuous clear or set
|
||||
|
||||
Reference in New Issue
Block a user