/** * add physic node to the hash ring with some virtual nodes * * @param pNode physical node needs added to hash ring * @param vNodeCount the number of virtual node of the physical node. Value should be greater than or equals to 0 */ public void addNode(T pNode, int vNodeCount) { if (vNodeCount < 0) throw new IllegalArgumentException("illegal virtual node counts :" + vNodeCount); int existingReplicas = getExistingReplicas(pNode); for (int i = 0; i < vNodeCount; i++) { VirtualNode<T> vNode = new VirtualNode<T>(pNode, i + existingReplicas); ring.put(hashFunction.hash(vNode.getKey()), vNode); } }
/** * add physic node to the hash ring with some virtual nodes * * @param pNode physical node needs added to hash ring * @param vNodeCount the number of virtual node of the physical node. Value should be greater than or equals to 0 */ public void addNode(T pNode, int vNodeCount) { if (vNodeCount < 0) throw new IllegalArgumentException("illegal virtual node counts :" + vNodeCount); int existingReplicas = getExistingReplicas(pNode); for (int i = 0; i < vNodeCount; i++) { VirtualNode<T> vNode = new VirtualNode<T>(pNode, i + existingReplicas); ring.put(hashFunction.hash(vNode.getKey()), vNode); } }
/** * add physic node to the hash ring with some virtual nodes * * @param pNode physical node needs added to hash ring * @param vNodeCount the number of virtual node of the physical node. Value should be greater than or equals to 0 */ public void addNode(T pNode, int vNodeCount) { if (vNodeCount < 0) throw new IllegalArgumentException("illegal virtual node counts :" + vNodeCount); int existingReplicas = getExistingReplicas(pNode); for (int i = 0; i < vNodeCount; i++) { VirtualNode<T> vNode = new VirtualNode<T>(pNode, i + existingReplicas); ring.put(hashFunction.hash(vNode.getKey()), vNode); } }