Package org.infinispan.util.hash

Examples of org.infinispan.util.hash.Hash


   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      ConsistentHash ch = (ConsistentHash) Util.getInstance(c.getConsistentHashClass(), c.getClassLoader());
      if (ch instanceof AbstractWheelConsistentHash) {
         Hash h = (Hash) Util.getInstance(c.getHashFunctionClass(), c.getClassLoader());
         AbstractWheelConsistentHash wch = (AbstractWheelConsistentHash) ch;
         wch.setHashFunction(h);
         wch.setNumVirtualNodes(c.getNumVirtualNodes());
      }
      if (ch instanceof AbstractConsistentHash) {
View Full Code Here


    * @param template An older consistent hash instance to clone
    * @param addresses with which to populate the consistent hash
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, Collection<Address> addresses) {
      Hash hf = null;
      int numVirtualNodes = 1;
      GroupManager groupManager = null;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
         hf = wTemplate.hashFunction;
View Full Code Here

      }
   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      Class<? extends ConsistentHash> chClass = Util.loadClass(c.getConsistentHashClass(), c.getClassLoader());
      Hash h = (Hash) Util.getInstance(c.getHashFunctionClass(), c.getClassLoader());
      HashSeed hs = c.getHashSeed() != null ? c.getHashSeed() :
            (HashSeed) Util.getInstance(c.getHashSeedClass(), c.getClassLoader());
      return constructConsistentHashInstance(chClass, h, hs, c.getNumVirtualNodes(), new GroupManagerImpl(c.getGroupers()));
   }
View Full Code Here

    * @param template An older consistent hash instance to clone
    * @param addresses with which to populate the consistent hash
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, Collection<Address> addresses) {
      Hash hf = null;
      HashSeed hs = null;
      int numVirtualNodes = 1;
      GroupManager groupManager = null;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
View Full Code Here

      @Override
      @SuppressWarnings("unchecked")
      public T readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         T instance = instance();
         instance.numVirtualNodes = unmarshaller.readInt();
         Hash hash = (Hash) unmarshaller.readObject();
         instance.setHashFunction(hash);
         Set<Address> caches = (Set<Address>) unmarshaller.readObject();
         instance.setCaches(caches);
         return instance;
      }
View Full Code Here

   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      ConsistentHash ch = (ConsistentHash) Util.getInstance(c.getConsistentHashClass());
      if (ch instanceof AbstractWheelConsistentHash) {
         Hash h = (Hash) Util.getInstance(c.getHashFunctionClass());
         AbstractWheelConsistentHash wch = (AbstractWheelConsistentHash) ch;
         wch.setHashFunction(h);
         wch.setNumVirtualNodes(c.getNumVirtualNodes());
      }
      return ch;
View Full Code Here

    * @param addresses with which to populate the consistent hash
    * @param topologyInfo
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, Collection<Address> addresses, TopologyInfo topologyInfo) {
      Hash hf = null;
      int numVirtualNodes = 1;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
         hf = wTemplate.hashFunction;
         numVirtualNodes = wTemplate.numVirtualNodes;
View Full Code Here

   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      ConsistentHash ch = (ConsistentHash) Util.getInstance(c.getConsistentHashClass(), Thread.currentThread().getContextClassLoader());
      if (ch instanceof AbstractWheelConsistentHash) {
         Hash h = (Hash) Util.getInstance(c.getHashFunctionClass(), Thread.currentThread().getContextClassLoader());
         AbstractWheelConsistentHash wch = (AbstractWheelConsistentHash) ch;
         wch.setHashFunction(h);
         wch.setNumVirtualNodes(c.getNumVirtualNodes());
      }
      if (ch instanceof AbstractConsistentHash) {
View Full Code Here

    * @param template An older consistent hash instance to clone
    * @param addresses with which to populate the consistent hash
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, Collection<Address> addresses) {
      Hash hf = null;
      int numVirtualNodes = 1;
      GroupManager groupManager = null;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
         hf = wTemplate.hashFunction;
View Full Code Here

      @Override
      @SuppressWarnings("unchecked")
      public T readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         T instance = instance();
         instance.numVirtualNodes = unmarshaller.readInt();
         Hash hash = (Hash) unmarshaller.readObject();
         instance.setHashFunction(hash);
         Set<Address> caches = (Set<Address>) unmarshaller.readObject();
         instance.setCaches(caches);
         return instance;
      }
View Full Code Here

TOP

Related Classes of org.infinispan.util.hash.Hash

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.