if (factory == null) {
CacheMode cacheMode = configuration.clustering().cacheMode();
if (cacheMode.isClustered()) {
if (cacheMode.isDistributed()) {
if (globalConfiguration.transport().hasTopologyInfo()) {
factory = new TopologyAwareConsistentHashFactory();
} else {
factory = new DefaultConsistentHashFactory();
}
} else {
// this is also used for invalidation mode