All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.hotrod.impl.consistenthash.ConsistentHashFactory Maven / Gradle / Ivy

The newest version!
package org.infinispan.hotrod.impl.consistenthash;


import org.infinispan.hotrod.configuration.HotRodConfiguration;
import org.infinispan.commons.util.Util;

/**
 * Factory for {@link org.infinispan.hotrod.impl.consistenthash.ConsistentHash} function. It will try to look
 * into the configuration for consistent hash definitions as follows:
 * consistent-hash.[version]=[fully qualified class implementing ConsistentHash]
 * e.g.
 * infinispan.client.hotrod.hash_function_impl.3=org.infinispan.hotrod.impl.consistenthash.SegmentConsistentHash
 * or if using the {@link HotRodConfiguration} API,
 * configuration.consistentHashImpl(3, org.infinispan.hotrod.impl.consistenthash.SegmentConsistentHash.class);
 * 

* *

The defaults are:

*
    *
  1. N/A (No longer used.)
  2. *
  3. org.infinispan.hotrod.impl.ConsistentHashV2
  4. *
  5. org.infinispan.hotrod.impl.SegmentConsistentHash
  6. *
* * @since 14.0 */ public class ConsistentHashFactory { private HotRodConfiguration configuration; public void init(HotRodConfiguration configuration) { this.configuration = configuration; } public T newConsistentHash(int version) { Class hashFunctionClass = configuration.consistentHashImpl(version); // TODO: Why create a brand new instance via reflection everytime a new hash topology is received? Caching??? return (T) Util.getInstance(hashFunctionClass); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy