Madan Jampani

Fixes how primitives and map keys are mapped to partitions

Change-Id: I68c9acabb400108def6eda394e2d5c8444ea5800
......@@ -22,8 +22,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang.StringUtils;
import org.onlab.util.Tools;
import org.onosproject.cluster.PartitionId;
import org.onosproject.store.primitives.DistributedPrimitiveCreator;
import org.onosproject.store.service.AsyncAtomicCounter;
......@@ -48,7 +46,6 @@ import com.google.common.primitives.Bytes;
* distributed primitives to a collection of other {@link DistributedPrimitiveCreator creators}.
*/
public class FederatedDistributedPrimitiveCreator implements DistributedPrimitiveCreator {
private final TreeMap<PartitionId, DistributedPrimitiveCreator> members;
private final List<PartitionId> sortedMemberPartitionIds;
......@@ -129,8 +126,7 @@ public class FederatedDistributedPrimitiveCreator implements DistributedPrimitiv
* @return primitive creator
*/
private DistributedPrimitiveCreator getCreator(String name) {
long hashCode = HashCode.fromBytes(Tools.getBytesUtf8(StringUtils.leftPad(name, 8))).asLong();
int index = Hashing.consistentHash(hashCode, members.size());
int index = Hashing.consistentHash(name.hashCode(), members.size());
return members.get(sortedMemberPartitionIds.get(index));
}
}
......