mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Use consistent hashing and thread local caches of StringBuilders.
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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1879,15 +1879,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