Examples of locateOwners()


Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

      }
   }

   protected void assertMapsToAddress(Object o, Address addr) {
      ConsistentHash hash = caches.get(0).getAdvancedCache().getDistributionManager().getConsistentHash();
      List<Address> addresses = hash.locateOwners(o);
      assertEquals("Expected key " + o + " to map to address " + addr + ". List of addresses is" + addresses, true, addresses.contains(addr));
   }

   protected List<Address> topology() {
      return topology(caches.get(0).getCacheManager());
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

                     boolean localExecutionNeeded = false;
                     for (Object key : affectedKeys) {
                        if (writeCh.isKeyLocalToNode(rpcManager.getAddress(), key)) {
                           localExecutionNeeded = true;
                        } else {
                           newTargets.addAll(writeCh.locateOwners(key));
                        }
                     }

                     if (localExecutionNeeded) {
                        return invokeNextInterceptor(ctx, command);
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

                  } finally {
                     newTargets = new HashSet<Address>();
                     Set<Object> affectedKeys = ((TxInvocationContext) ctx).getAffectedKeys();
                     for (Object key : affectedKeys) {
                        if (!writeCh.isKeyLocalToNode(rpcManager.getAddress(), key)) {
                           newTargets.addAll(writeCh.locateOwners(key));
                        }
                     }
                  }
               }
            } else if (command.getTopologyId() > topologyId) {
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

                     boolean localExecutionNeeded = false;
                     for (Object key : affectedKeys) {
                        if (writeCh.isKeyLocalToNode(rpcManager.getAddress(), key)) {
                           localExecutionNeeded = true;
                        } else {
                           newTargets.addAll(writeCh.locateOwners(key));
                        }
                     }

                     if (localExecutionNeeded) {
                        return invokeNextInterceptor(ctx, command);
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

                  } finally {
                     newTargets = new HashSet<Address>();
                     Set<Object> affectedKeys = ((TxInvocationContext) ctx).getAffectedKeys();
                     for (Object key : affectedKeys) {
                        if (!writeCh.isKeyLocalToNode(rpcManager.getAddress(), key)) {
                           newTargets.addAll(writeCh.locateOwners(key));
                        }
                     }
                  }
               }
            } else if (command.getTopologyId() > topologyId) {
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

   @Test (dependsOnMethods = "testServersDropped")
   public void testCollocatedKey() {
      ConsistentHash hash = manager(0).getCache(cacheName).getAdvancedCache().getDistributionManager().getConsistentHash();
      for (int i = 0; i < 1000; i++) {
         List<Address> addresses = hash.locateOwners(i);
         Object collocatedKey = keyAffinityService.getCollocatedKey(i);
         List<Address> addressList = hash.locateOwners(collocatedKey);
         assertEquals(addresses, addressList);
      }
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

   public void testCollocatedKey() {
      ConsistentHash hash = manager(0).getCache(cacheName).getAdvancedCache().getDistributionManager().getConsistentHash();
      for (int i = 0; i < 1000; i++) {
         List<Address> addresses = hash.locateOwners(i);
         Object collocatedKey = keyAffinityService.getCollocatedKey(i);
         List<Address> addressList = hash.locateOwners(collocatedKey);
         assertEquals(addresses, addressList);
      }
   }

   public class KeyConsumer extends Thread {
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

      }
   }

   protected void assertMapsToAddress(Object o, Address addr) {
      ConsistentHash hash = caches.get(0).getAdvancedCache().getDistributionManager().getConsistentHash();
      List<Address> addresses = hash.locateOwners(o);
      assertEquals("Expected key " + o + " to map to address " + addr + ". List of addresses is" + addresses, true, addresses.contains(addr));
   }

   protected List<Address> topology() {
      return topology(caches.get(0).getCacheManager());
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

      ConsistentHash ch = createNewConsistentHash(createAddresses(numNodes));
      int dummy = 0;
      long start = System.nanoTime();
      for (int i = 0; i < iterations; i++) {
         Object key = i;
         dummy += ch.locateOwners(key).size();
      }
      long duration = System.nanoTime() - start;
      assert dummy == iterations * min(numOwners, numNodes);
      return duration;
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash.locateOwners()

      ConsistentHash ch = createNewConsistentHash(createAddresses(numNodes));

      Map<Address, Integer> distribution = new HashMap<Address, Integer>();

      for (Object key : keys) {
         Address a = ch.locateOwners(key).get(0);
         if (distribution.containsKey(a)) {
            int i = distribution.get(a);
            distribution.put(a, i + 1);
         } else {
            distribution.put(a, 1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.