Make JedisClusterCRC16 multi-thread
This commit is contained in:
@@ -2,7 +2,6 @@ package redis.clients.util;
|
|||||||
|
|
||||||
public class JedisClusterCRC16 {
|
public class JedisClusterCRC16 {
|
||||||
public final static int polynomial = 0x1021; // Represents x^16+x^12+x^5+1
|
public final static int polynomial = 0x1021; // Represents x^16+x^12+x^5+1
|
||||||
static int crc;
|
|
||||||
|
|
||||||
|
|
||||||
public static int getSlot(String key) {
|
public static int getSlot(String key) {
|
||||||
@@ -17,7 +16,7 @@ public class JedisClusterCRC16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int getCRC16(String key) {
|
private static int getCRC16(String key) {
|
||||||
crc = 0x0000;
|
int crc = 0x0000;
|
||||||
for (byte b : key.getBytes()) {
|
for (byte b : key.getBytes()) {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
boolean bit = ((b >> (7 - i) & 1) == 1);
|
boolean bit = ((b >> (7 - i) & 1) == 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user