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);
  }
Create a new KetamaNodeLocator with specific nodes, hash, node key format,
and weight

@param nodes The List of nodes to use in the Ketama consistent hash
         continuum
@param alg The hash algorithm to use when choosing a node in the Ketama
         consistent hash continuum
@param weights node weights for ketama, a map from InetSocketAddress to
         weight as Integer
@param configuration node locator configuration
src/main/java/net/spy/memcached/KetamaNodeLocator.java