Skip to content

Commit 29ba760

Browse files
edrevogzm55
authored andcommitted
Fix static initialization deadlock (Fixes #53)
1 parent fb8f9d4 commit 29ba760

File tree

9 files changed

+5
-10
lines changed

9 files changed

+5
-10
lines changed

src/main/java/net/openhft/hashing/CityAndFarmHash_1_1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import static java.lang.Long.reverseBytes;
2020
import static java.lang.Long.rotateRight;
2121
import static java.nio.ByteOrder.LITTLE_ENDIAN;
22-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
22+
import static net.openhft.hashing.Primitives.NATIVE_LITTLE_ENDIAN;
2323

2424
/**
2525
* Adapted from the C++ CityHash implementation from Google at

src/main/java/net/openhft/hashing/MetroHash.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.openhft.hashing;
22

33
import static java.nio.ByteOrder.LITTLE_ENDIAN;
4-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
54

65
class MetroHash {
76
//primes

src/main/java/net/openhft/hashing/MurmurHash_3.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import org.jetbrains.annotations.Nullable;
2121
import javax.annotation.ParametersAreNonnullByDefault;
2222

23-
import static java.lang.Long.reverseBytes;
2423
import static java.nio.ByteOrder.LITTLE_ENDIAN;
25-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
2624
import static net.openhft.hashing.Primitives.unsignedInt;
2725
import static net.openhft.hashing.Primitives.unsignedShort;
2826

src/main/java/net/openhft/hashing/Primitives.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616

1717
package net.openhft.hashing;
1818

19-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
19+
import static java.nio.ByteOrder.LITTLE_ENDIAN;
20+
import static java.nio.ByteOrder.nativeOrder;
2021

2122
final class Primitives {
2223

2324
private Primitives() {}
2425

26+
static final boolean NATIVE_LITTLE_ENDIAN = nativeOrder() == LITTLE_ENDIAN;
27+
2528
static long unsignedInt(int i) {
2629
return i & 0xFFFFFFFFL;
2730
}

src/main/java/net/openhft/hashing/UnsafeAccess.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sun.misc.Unsafe;
2222

2323
import static net.openhft.hashing.Primitives.*;
24-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
2524

2625
public class UnsafeAccess extends Access<Object> {
2726
static final UnsafeAccess INSTANCE;

src/main/java/net/openhft/hashing/Util.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import static java.nio.ByteOrder.*;
99

1010
final class Util {
11-
static final boolean NATIVE_LITTLE_ENDIAN = nativeOrder() == LITTLE_ENDIAN;
1211

1312
/* Known java.vm.name list:
1413
*

src/main/java/net/openhft/hashing/WyHash.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.openhft.hashing;
22

33
import static java.nio.ByteOrder.LITTLE_ENDIAN;
4-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
54

65
/**
76
* Adapted version of WyHash implementation from https://github.com/wangyi-fudan/wyhash

src/main/java/net/openhft/hashing/XXH3.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static java.nio.ByteOrder.LITTLE_ENDIAN;
2222
import static net.openhft.hashing.Maths.unsignedLongMulXorFold;
2323
import static net.openhft.hashing.UnsafeAccess.*;
24-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
2524

2625
/**
2726
* Adapted version of XXH3 implementation from https://github.com/Cyan4973/xxHash.

src/main/java/net/openhft/hashing/XxHash.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package net.openhft.hashing;
1818

1919
import static java.nio.ByteOrder.LITTLE_ENDIAN;
20-
import static net.openhft.hashing.Util.NATIVE_LITTLE_ENDIAN;
2120

2221
/**
2322
* Adapted version of xxHash implementation from https://github.com/Cyan4973/xxHash.

0 commit comments

Comments
 (0)