com.jchanghong.core.lang.ConsistentHash Maven / Gradle / Ivy
The newest version!
package com.jchanghong.core.lang;
import com.jchanghong.core.lang.hash.Hash32;
import com.jchanghong.core.util.HashUtil;
import java.io.Serializable;
import java.util.Collection;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* 一致性Hash算法
* 算法详解:http://blog.csdn.net/sparkliang/article/details/5279393
* 算法实现:https://weblogs.java.net/blog/2007/11/27/consistent-hashing
* @author xiaoleilu
*
* @param 节点类型
*/
public class ConsistentHash implements Serializable{
private static final long serialVersionUID = 1L;
/** Hash计算对象,用于自定义hash算法 */
Hash32