private synchronized void addInternal(T node, int replica) { if (replica==0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i=0; i<replica; i++) points[i] = new Point(md5(seed+':'+i),node); items.put(node,points); } }
private synchronized void addInternal(T node, int replica) { if (replica==0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i=0; i<replica; i++) points[i] = new Point(md5(seed+':'+i),node); items.put(node,points); } }
/** * Adds a new node with the given number of replica. * * <p> * This is the only function that manipulates {@link #items}. */ public synchronized void add(T node, int replica) { if(replica==0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i=0; i<replica; i++) points[i] = new Point(md5(seed+':'+i),node); items.put(node,points); } table = new Table(); }
/** * Adds a new node with the given number of replica. * * <p> * This is the only function that manipulates {@link #items}. */ public synchronized void add(T node, int replica) { if(replica==0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i=0; i<replica; i++) points[i] = new Point(md5(seed+':'+i),node); items.put(node,points); } table = new Table(); }
/** * Adds a new node with the given number of replica. * * <p> * This is the only function that manipulates {@link #items}. */ public synchronized void add(T node, int replica) { if(replica==0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i=0; i<replica; i++) points[i] = new Point(md5(seed+':'+i),node); items.put(node,points); } table = new Table(); }
/** * Adds a new node with the given number of replica. * * <p> This is the only function that manipulates {@link #items}. */ public synchronized void add(T node, int replica) { if (replica == 0) { items.remove(node); } else { Point[] points = new Point[replica]; String seed = hash.hash(node); for (int i = 0; i < replica; i++) { points[i] = new Point(md5(seed + ':' + i), node); } items.put(node, points); } table = new Table(); }