Package org.infinispan.commons.hash

Examples of org.infinispan.commons.hash.MurmurHash3


* @see org.infinispan.commons.hash.MurmurHash3
* @since 5.0
*/
public class ConsistentHashV2 extends ConsistentHashV1 {
   public ConsistentHashV2() {
      hash = new MurmurHash3();
   }
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

* @see org.infinispan.commons.hash.MurmurHash3
* @since 5.0
*/
public class ConsistentHashV2 extends ConsistentHashV1 {
   public ConsistentHashV2() {
      hash = new MurmurHash3();
   }
View Full Code Here

      members2.remove(F);
      members2.add(G);

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

      // create dependencies
      when(mockExecutorService.submit(any(Runnable.class))).thenAnswer(new Answer<Future<?>>() {
         @Override
View Full Code Here

      members2.remove(F);
      members2.add(G);

      // create CHes
      DefaultConsistentHashFactory chf = new DefaultConsistentHashFactory();
      DefaultConsistentHash ch1 = chf.create(new MurmurHash3(), 2, numSegments, members1);
      DefaultConsistentHash ch2 = chf.updateMembers(ch1, members2);   //todo [anistor] it seems that address 6 is not used for un-owned segments

      when(commandsFactory.buildStateResponseCommand(any(Address.class), anyInt(), any(Collection.class))).thenAnswer(new Answer<StateResponseCommand>() {
         @Override
         public StateResponseCommand answer(InvocationOnMock invocation) {
View Full Code Here

      members2.remove(new TestAddress(5));
      members2.add(new TestAddress(6));

      // create CHes
      DefaultConsistentHashFactory chf = new DefaultConsistentHashFactory();
      DefaultConsistentHash ch1 = chf.create(new MurmurHash3(), 2, 4, members1);
      DefaultConsistentHash ch2 = chf.updateMembers(ch1, members2);   //todo [anistor] it seems that address 6 is not used for un-owned segments

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

      try {
         ConfigurationBuilder builder = new ConfigurationBuilder();
         builder.clustering().hash()
            .consistentHash(null);
         // TODO Revisit after we have replaced the CH with the CHFactory in the configuration
         return new DefaultConsistentHashFactory().create(new MurmurHash3(), 2, 10, servers);
      } catch (RuntimeException re) {
         throw re;
      } catch (Exception e) {
         throw new RuntimeException(e);
      }
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

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

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

      assertAllLocationsWithRebalance(2);
      assertAllLocationsWithRebalance(3);
   }

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

      List<Address> membersWithLoad = computeNodesWithLoad(chMembers);
      assertAllLocations(numOwners, membersWithLoad);
      assertDistribution(numOwners, membersWithLoad);

      ch = chf.create(new MurmurHash3(), numOwners, numSegments, chMembers.subList(0, 1), capacityFactors);
      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

TOP

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

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.