public ConsistentHash(Hash<T> hash, int defaultReplication) { this.hash = hash; this.defaultReplication = defaultReplication; refreshTable(); }
/** * Calls {@link #add(Object)} with all the arguments. */ public synchronized void addAll(Collection<? extends T> nodes) { for (T node : nodes) addInternal(node,defaultReplication); refreshTable(); }
/** * Calls {@link #add(Object,int)} with all the arguments. */ public synchronized void addAll(Map<? extends T,Integer> nodes) { for (Map.Entry<? extends T,Integer> node : nodes.entrySet()) addInternal(node.getKey(),node.getValue()); refreshTable(); }
/** * Calls {@link #add(Object)} with all the arguments. */ public synchronized void addAll(T... nodes) { for (T node : nodes) addInternal(node,defaultReplication); refreshTable(); }
/** * Adds a new node with the given number of replica. */ public synchronized void add(T node, int replica) { addInternal(node, replica); refreshTable(); }
public ConsistentHash(Hash<T> hash, int defaultReplication) { this.hash = hash; this.defaultReplication = defaultReplication; refreshTable(); }
/** * Adds a new node with the given number of replica. */ public synchronized void add(T node, int replica) { addInternal(node, replica); refreshTable(); }
/** * Calls {@link #add(Object)} with all the arguments. */ public synchronized void addAll(T... nodes) { for (T node : nodes) addInternal(node,defaultReplication); refreshTable(); }
/** * Calls {@link #add(Object)} with all the arguments. */ public synchronized void addAll(Collection<? extends T> nodes) { for (T node : nodes) addInternal(node,defaultReplication); refreshTable(); }
/** * Calls {@link #add(Object,int)} with all the arguments. */ public synchronized void addAll(Map<? extends T,Integer> nodes) { for (Map.Entry<? extends T,Integer> node : nodes.entrySet()) addInternal(node.getKey(),node.getValue()); refreshTable(); }