private static Collection<Token> adjustForCrossDatacenterClashes(final TokenMetadata tokenMetadata, StrategyAdapter strategy, Collection<Token> tokens) { List<Token> filtered = Lists.newArrayListWithCapacity(tokens.size()); for (Token t : tokens) { while (tokenMetadata.getEndpoint(t) != null) { InetAddress other = tokenMetadata.getEndpoint(t); if (strategy.inAllocationRing(other)) throw new ConfigurationException(String.format("Allocated token %s already assigned to node %s. Is another node also allocating tokens?", t, other)); t = t.increaseSlightly(); } filtered.add(t); } return filtered; }
private static Collection<Token> adjustForCrossDatacenterClashes(final TokenMetadata tokenMetadata, StrategyAdapter strategy, Collection<Token> tokens) { List<Token> filtered = Lists.newArrayListWithCapacity(tokens.size()); for (Token t : tokens) { while (tokenMetadata.getEndpoint(t) != null) { InetAddress other = tokenMetadata.getEndpoint(t); if (strategy.inAllocationRing(other)) throw new ConfigurationException(String.format("Allocated token %s already assigned to node %s. Is another node also allocating tokens?", t, other)); t = t.increaseSlightly(); } filtered.add(t); } return filtered; }
private static Collection<Token> adjustForCrossDatacenterClashes(final TokenMetadata tokenMetadata, StrategyAdapter strategy, Collection<Token> tokens) { List<Token> filtered = Lists.newArrayListWithCapacity(tokens.size()); for (Token t : tokens) { while (tokenMetadata.getEndpoint(t) != null) { InetAddress other = tokenMetadata.getEndpoint(t); if (strategy.inAllocationRing(other)) throw new ConfigurationException(String.format("Allocated token %s already assigned to node %s. Is another node also allocating tokens?", t, other)); t = t.increaseSlightly(); } filtered.add(t); } return filtered; }