Package org.infinispan.commons.hash

Examples of org.infinispan.commons.hash.Hash


      }

      @Override
      public CacheJoinInfo readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         ConsistentHashFactory consistentHashFactory = (ConsistentHashFactory) unmarshaller.readObject();
         Hash hashFunction = (Hash) unmarshaller.readObject();
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         long timeout = unmarshaller.readLong();
         return new CacheJoinInfo(consistentHashFactory, hashFunction, numSegments, numOwners, timeout);
      }
View Full Code Here


      @SuppressWarnings("unchecked")
      public DefaultConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         Hash hash = (Hash) unmarshaller.readObject();
         Address[][] segmentOwners = (Address[][]) unmarshaller.readObject();

         List<Address>[] segmentOwnerList = new List[segmentOwners.length];
         for (int i = 0; i < segmentOwners.length; i++) {
            segmentOwnerList[i] = Arrays.asList(segmentOwners[i]);
View Full Code Here

      // * floor(numSegments*numOwners/numNodes) <= num_segments_owned(n) for each node n
      // It will not change primary owners or remove old owners, but it will prepare things for the next phase
      // to remove owners so that
      // * num_segments_primary_owned(n) <= ceil(numSegments/numNodes) for each node n
      // * num_segments_owned(n) <= ceil(numSegments*numOwners/numNodes) for each node n
      Hash hashFunction = baseCH.getHashFunction();
      List<Address> nodes = baseCH.getMembers();

      OwnershipStatistics stats = computeStatistics(baseCH, nodes);

      // Copy the owners list out of the old CH
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());
      return constructConsistentHashInstance(chClass, h, 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;
      int numVirtualNodes = 1;
      GroupManager groupManager = null;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
         hf = wTemplate.hashFunction;
View Full Code Here

      @SuppressWarnings("unchecked")
      public DefaultConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         Hash hash = (Hash) unmarshaller.readObject();
         Address[][] segmentOwners = (Address[][]) unmarshaller.readObject();

         List<Address>[] segmentOwnerList = new List[segmentOwners.length];
         for (int i = 0; i < segmentOwners.length; i++) {
            segmentOwnerList[i] = Arrays.asList(segmentOwners[i]);
View Full Code Here

      // * floor(numSegments*numOwners/numNodes) <= num_segments_owned(n) for each node n
      // It will not change primary owners or remove old owners, but it will prepare things for the next phase
      // to remove owners so that
      // * num_segments_primary_owned(n) <= ceil(numSegments/numNodes) for each node n
      // * num_segments_owned(n) <= ceil(numSegments*numOwners/numNodes) for each node n
      Hash hashFunction = baseCH.getHashFunction();
      List<Address> nodes = baseCH.getMembers();

      OwnershipStatistics stats = computeStatistics(baseCH, nodes);

      // Copy the owners list out of the old CH
View Full Code Here

      }

      @Override
      public CacheJoinInfo readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         ConsistentHashFactory consistentHashFactory = (ConsistentHashFactory) unmarshaller.readObject();
         Hash hashFunction = (Hash) unmarshaller.readObject();
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         long timeout = unmarshaller.readLong();
         boolean totalOrder = unmarshaller.readBoolean();
         boolean distributed = unmarshaller.readBoolean();
View Full Code Here

      int[] numOwners = {1, 2, 3, 5};
      // Since the number of nodes changes, the capacity factors are repeated
      float[][] capacityFactors = {null, {1}, {2}, {1, 100}, {2, 0, 1}};

      ConsistentHashFactory <DefaultConsistentHash> chf = createConsistentHashFactory();
      Hash hashFunction = new MurmurHash3();

      for (int nn : numNodes) {
         List<Address> nodes = new ArrayList<Address>(nn);
         for (int j = 0; j < nn; j++) {
            nodes.add(new TestAddress(j, "TA"));
View Full Code Here

      public DefaultConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         Map<Address, Float> capacityFactors = (Map<Address, Float>)unmarshaller.readObject();
         Hash hash = (Hash) unmarshaller.readObject();
         List<Address>[] owners = (List<Address>[]) unmarshaller.readObject();

         return new DefaultConsistentHash(hash, numOwners, numSegments, members, capacityFactors, owners);
      }
View Full Code Here

TOP

Related Classes of org.infinispan.commons.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.