long getMaxKey() { return getKetamaNodes().lastKey(); }
long getMaxKey() { return getKetamaNodes().lastKey(); }
long getMaxKey() { return getKetamaNodes().lastKey(); }
long getMaxKey() { return getKetamaNodes().lastKey(); }
long getMaxKey() { return getKetamaNodes().lastKey(); }
MemcachedNode getNodeForKey(long hash) { final MemcachedNode rv; if (!ketamaNodes.containsKey(hash)) { // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5 // in a lot of places, so I'm doing this myself. SortedMap<Long, MemcachedNode> tailMap = getKetamaNodes().tailMap(hash); if (tailMap.isEmpty()) { hash = getKetamaNodes().firstKey(); } else { hash = tailMap.firstKey(); } } rv = getKetamaNodes().get(hash); return rv; }
MemcachedNode getNodeForKey(long hash) { final MemcachedNode rv; if(!ketamaNodes.containsKey(hash)) { // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5 // in a lot of places, so I'm doing this myself. SortedMap<Long, MemcachedNode> tailMap=getKetamaNodes().tailMap(hash); if(tailMap.isEmpty()) { hash=getKetamaNodes().firstKey(); } else { hash=tailMap.firstKey(); } } rv=getKetamaNodes().get(hash); return rv; }
MemcachedNode getNodeForKey(long hash) { final MemcachedNode rv; if (!ketamaNodes.containsKey(hash)) { // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5 // in a lot of places, so I'm doing this myself. SortedMap<Long, MemcachedNode> tailMap = getKetamaNodes().tailMap(hash); if (tailMap.isEmpty()) { hash = getKetamaNodes().firstKey(); } else { hash = tailMap.firstKey(); } } rv = getKetamaNodes().get(hash); return rv; }
MemcachedNode getNodeForKey(long hash) { final MemcachedNode rv; if (!ketamaNodes.containsKey(hash)) { // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5 // in a lot of places, so I'm doing this myself. SortedMap<Long, MemcachedNode> tailMap = getKetamaNodes().tailMap(hash); if (tailMap.isEmpty()) { hash = getKetamaNodes().firstKey(); } else { hash = tailMap.firstKey(); } } rv = getKetamaNodes().get(hash); return rv; }
MemcachedNode getNodeForKey(long hash) { final MemcachedNode rv; if (!ketamaNodes.containsKey(hash)) { // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5 // in a lot of places, so I'm doing this myself. SortedMap<Long, MemcachedNode> tailMap = getKetamaNodes().tailMap(hash); if (tailMap.isEmpty()) { hash = getKetamaNodes().firstKey(); } else { hash = tailMap.firstKey(); } } rv = getKetamaNodes().get(hash); return rv; }
public Iterator<MemcachedNode> getSequence(String k) { // Seven searches gives us a 1 in 2^7 chance of hitting the // same dead node all of the time. return new KetamaIterator(k, 7, getKetamaNodes(), hashAlg); }
public Iterator<MemcachedNode> getSequence(String k) { // Seven searches gives us a 1 in 2^7 chance of hitting the // same dead node all of the time. return new KetamaIterator(k, 7, getKetamaNodes(), hashAlg); }
public Iterator<MemcachedNode> getSequence(String k) { // Seven searches gives us a 1 in 2^7 chance of hitting the // same dead node all of the time. return new KetamaIterator(k, 7, getKetamaNodes(), hashAlg); }
public Iterator<MemcachedNode> getSequence(String k) { // Seven searches gives us a 1 in 2^7 chance of hitting the // same dead node all of the time. return new KetamaIterator(k, 7, getKetamaNodes(), hashAlg); }
public Iterator<MemcachedNode> getSequence(String k) { // Seven searches gives us a 1 in 2^7 chance of hitting the // same dead node all of the time. return new KetamaIterator(k, 7, getKetamaNodes(), hashAlg); }
public NodeLocator getReadonlyCopy() { TreeMap<Long, MemcachedNode> smn = new TreeMap<Long, MemcachedNode>(getKetamaNodes()); Collection<MemcachedNode> an = new ArrayList<MemcachedNode>(allNodes.size()); // Rewrite the values a copy of the map. for (Map.Entry<Long, MemcachedNode> me : smn.entrySet()) { me.setValue(new MemcachedNodeROImpl(me.getValue())); } // Copy the allNodes collection. for (MemcachedNode n : allNodes) { an.add(new MemcachedNodeROImpl(n)); } return new KetamaNodeLocator(smn, an, hashAlg, config); }
public NodeLocator getReadonlyCopy() { TreeMap<Long, MemcachedNode> smn = new TreeMap<Long, MemcachedNode>(getKetamaNodes()); Collection<MemcachedNode> an = new ArrayList<MemcachedNode>(allNodes.size()); // Rewrite the values a copy of the map. for (Map.Entry<Long, MemcachedNode> me : smn.entrySet()) { smn.put(me.getKey(), new MemcachedNodeROImpl(me.getValue())); } // Copy the allNodes collection. for (MemcachedNode n : allNodes) { an.add(new MemcachedNodeROImpl(n)); } return new KetamaNodeLocator(smn, an, hashAlg, weights, config); }
public NodeLocator getReadonlyCopy() { TreeMap<Long, MemcachedNode> smn = new TreeMap<Long, MemcachedNode>(getKetamaNodes()); Collection<MemcachedNode> an = new ArrayList<MemcachedNode>(allNodes.size()); // Rewrite the values a copy of the map. for (Map.Entry<Long, MemcachedNode> me : smn.entrySet()) { me.setValue(new MemcachedNodeROImpl(me.getValue())); } // Copy the allNodes collection. for (MemcachedNode n : allNodes) { an.add(new MemcachedNodeROImpl(n)); } return new KetamaNodeLocator(smn, an, hashAlg, config); }
public NodeLocator getReadonlyCopy() { TreeMap<Long, MemcachedNode> smn = new TreeMap<Long, MemcachedNode>(getKetamaNodes()); Collection<MemcachedNode> an = new ArrayList<MemcachedNode>(allNodes.size()); // Rewrite the values a copy of the map. for (Map.Entry<Long, MemcachedNode> me : smn.entrySet()) { smn.put(me.getKey(), new MemcachedNodeROImpl(me.getValue())); } // Copy the allNodes collection. for (MemcachedNode n : allNodes) { an.add(new MemcachedNodeROImpl(n)); } return new KetamaNodeLocator(smn, an, hashAlg, weights, config); }
public NodeLocator getReadonlyCopy() { TreeMap<Long, MemcachedNode> smn=new TreeMap<Long, MemcachedNode>( getKetamaNodes()); Collection<MemcachedNode> an= new ArrayList<MemcachedNode>(allNodes.size()); // Rewrite the values a copy of the map. for(Map.Entry<Long, MemcachedNode> me : smn.entrySet()) { me.setValue(new MemcachedNodeROImpl(me.getValue())); } // Copy the allNodes collection. for(MemcachedNode n : allNodes) { an.add(new MemcachedNodeROImpl(n)); } return new KetamaNodeLocator(smn, an, hashAlg, config); }