if (config == null) {
throw new IllegalStateException("Couldn't get config");
}
if (config.getConfigType() == ConfigType.MEMCACHE) {
return new KetamaNodeLocator(nodes, DefaultHashAlgorithm.KETAMA_HASH);
} else if (config.getConfigType() == ConfigType.COUCHBASE) {
return new VBucketNodeLocator(nodes, getVBucketConfig());
} else {
throw new IllegalStateException("Unhandled locator type: "
+ config.getConfigType());