Make JedisClusterCRC16 multi-thread

This commit is contained in:
Marcos Nils
2014-02-20 14:58:04 -03:00
parent 3f8507a117
commit 756113821f

View File

@@ -2,7 +2,6 @@ package redis.clients.util;
public class JedisClusterCRC16 {
public final static int polynomial = 0x1021; // Represents x^16+x^12+x^5+1
static int crc;
public static int getSlot(String key) {
@@ -17,7 +16,7 @@ public class JedisClusterCRC16 {
}
private static int getCRC16(String key) {
crc = 0x0000;
int crc = 0x0000;
for (byte b : key.getBytes()) {
for (int i = 0; i < 8; i++) {
boolean bit = ((b >> (7 - i) & 1) == 1);