Package org.infinispan.commons.hash

Examples of org.infinispan.commons.hash.MurmurHash3$State


      List<Address> members1 = Arrays.asList(addresses[0], addresses[1], addresses[2], addresses[3]);
      List<Address> members2 = Arrays.asList(addresses[0], addresses[1], addresses[2]);

      // create CHes
      DefaultConsistentHashFactory chf = new DefaultConsistentHashFactory();
      DefaultConsistentHash ch1 = chf.create(new MurmurHash3(), 2, 40, members1);
      final DefaultConsistentHash ch2 = chf.updateMembers(ch1, members2);
      DefaultConsistentHash ch3 = chf.rebalance(ch2);

      log.debug(ch1);
      log.debug(ch2);
View Full Code Here


      Address a3 = new JGroupsAddress(UUID.randomUUID());
      List<Address> oldAddresses = new ArrayList<Address>();
      oldAddresses.add(a1);
      oldAddresses.add(a2);
      DefaultConsistentHashFactory chf = new DefaultConsistentHashFactory();
      DefaultConsistentHash oldCh = chf.create(new MurmurHash3(), 2, 3, oldAddresses);
      List<Address> newAddresses = new ArrayList<Address>();
      newAddresses.add(a1);
      newAddresses.add(a2);
      newAddresses.add(a3);
      DefaultConsistentHash newCh = chf.create(new MurmurHash3(), 2, 3, newAddresses);
      StateRequestCommand c14 = new StateRequestCommand(cacheName, StateRequestCommand.Type.START_STATE_TRANSFER, a1, 99, null);
      byte[] bytes = marshaller.objectToByteBuffer(c14);
      marshaller.objectFromByteBuffer(bytes);

      bytes = marshaller.objectToByteBuffer(c14);
View Full Code Here

   public static final double[] INTERVALS_PRIMARY = { 1.5 };
   // percentiles to print
   public static final double[] PERCENTILES = { .999 };

   private DefaultConsistentHash createConsistentHash(int numSegments, int numOwners, int numNodes) {
      MurmurHash3 hash = new MurmurHash3();
      SyncConsistentHashFactory chf = new SyncConsistentHashFactory();
      DefaultConsistentHash ch = chf.create(hash, numOwners, numSegments, createAddresses(numNodes));
      return ch;
   }
View Full Code Here

      List<Address> abcd = Arrays.asList(A, B, C, D);
      List<Address> bcd = Arrays.asList(B, C, D);
      List<Address> c = Arrays.asList(C);

      for (int segments : testSegments) {
         ReplicatedConsistentHash ch = factory.create(new MurmurHash3(), 0, segments, a);
         checkDistribution(ch);

         ch = factory.updateMembers(ch, ab);
         checkDistribution(ch);
View Full Code Here

      int[] numSegments = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
      int[] numNodes = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000};
      int[] numOwners = {1, 2, 3, 5};

      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));
View Full Code Here

      TestAddress A = new TestAddress(0, "A");
      TestAddress B = new TestAddress(1, "B");
      TestAddress C = new TestAddress(2, "C");
      TestAddress D = new TestAddress(3, "D");

      DefaultConsistentHash ch1 = chf.create(new MurmurHash3(), 2, 60, Arrays.<Address>asList(A));
      //System.out.println(ch1);

      DefaultConsistentHash ch2 = chf.updateMembers(ch1, Arrays.<Address>asList(A, B));
      ch2 = chf.rebalance(ch2);
      //System.out.println(ch2);
View Full Code Here

      assertAllLocationsWithRebalance(1);
      assertAllLocationsWithRebalance(2);
   }

   private void assertAllLocationsWithRebalance(int numOwners) {
      ch = chf.create(new MurmurHash3(), numOwners, numSegments, chMembers);
      assertAllLocations(numOwners, chMembers);
      assertDistribution(numOwners, chMembers);

      ch = chf.create(new MurmurHash3(), numOwners, numSegments, chMembers.subList(0, 1));
      assertAllLocations(numOwners, chMembers.subList(0, 1));

      for (int i = 2; i <= chMembers.size(); i++) {
         List<Address> currentMembers = chMembers.subList(0, i);
         log.debugf("Created CH with numOwners %d, members %s", numOwners, currentMembers);
View Full Code Here

      address.setMachineId(machineId);
      chMembers.add(address);
   }

   protected void updateConsistentHash(int numOwners) {
      ch = chf.create(new MurmurHash3(), numOwners, numSegments, chMembers);
      log.debugf("Created CH with numOwners %d, members %s", numOwners, chMembers);
   }
View Full Code Here

         map.put(new InetSocketAddress(i), Collections.singleton(i * 1000));
      }


      dch.init(map, 2, 10024);
      dch.setHash(new MurmurHash3());
   }
View Full Code Here

      List<Address> members1 = Arrays.asList(addresses[0], addresses[1], addresses[2], addresses[3], addresses[4]);
      List<Address> members2 = Arrays.asList(addresses[0], addresses[1], addresses[2], addresses[3]);

      // create CHes
      DefaultConsistentHashFactory chf = new DefaultConsistentHashFactory();
      DefaultConsistentHash ch1 = chf.create(new MurmurHash3(), 2, 4, members1);
      DefaultConsistentHash ch2 = chf.updateMembers(ch1, members2);
      DefaultConsistentHash ch3 = chf.rebalance(ch2);

      log.debug(ch1);
      log.debug(ch2);
View Full Code Here

TOP

Related Classes of org.infinispan.commons.hash.MurmurHash3$State

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.