Examples of locateOwners()


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

               owners++;
            }
            if (dc2.get(i) != null) {
               owners++;
            }
            assertEquals("Wrong number of owners", ch.locateOwners(i).size(), owners);
         }
      }
   }
}
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()

            for (int k = 0; k < NUM_ITERATIONS; k++) {
               String key = keyFor(i, j, k);
               if (keysToIgnore.contains(key)) {
                  log.infof("Skipping test on failing key %s", key);
               } else {
                  List<Address> owners = hash.locateOwners(key);
                  for (Map.Entry<Address, Cache<Object, Object>> e : cacheMap.entrySet()) {
                     try {
                        if (owners.contains(e.getKey())) DistributionTestHelper.assertIsInContainerImmortal(e.getValue(), key);
                        // Don't bother testing non-owners since invalidations caused by rehashing are async!
                     } catch (Throwable th) {
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

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

      // compatibility with 1.0/1.1 clients is not perfect, so we must allow for some misses
      int misses = 0;
      for (int i = 0; i < 200; i++) {
         byte[] keyBytes = (byte[]) kas.getKeyForAddress(address(cacheIndex));
         String key = DistributionRetryTest.ByteKeyGenerator.getStringObject(keyBytes);
         List<Address> serverBackups = serverCH.locateOwners(keyBytes);
         assert serverBackups.contains(address(cacheIndex));
         remoteCache.put(key, "v");

         Address hitServer = getHitServer();
         if (!serverBackups.contains(hitServer)) {
View Full Code Here

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

      if (entry == null || entry.isNull() || entry.isLockPlaceholder()) {
         Object key = command.getKey();
         ConsistentHash ch = stateTransferManager.getCacheTopology().getReadConsistentHash();
         shouldFetchFromRemote = ctx.isOriginLocal() && !ch.isKeyLocalToNode(rpcManager.getAddress(), key) && !dataContainer.containsKey(key);
         if (!shouldFetchFromRemote && getLog().isTraceEnabled()) {
            getLog().tracef("Not doing a remote get for key %s since entry is mapped to current node (%s) or is in L1. Owners are %s", key, rpcManager.getAddress(), ch.locateOwners(key));
         }
      }
      return shouldFetchFromRemote;
   }
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()

               owners++;
            }
            if (dc2.get(i) != null) {
               owners++;
            }
            assertEquals("Wrong number of owners", ch.locateOwners(i).size(), owners);

            // check values were not overwritten with old values carried by state transfer
            String expected = "after_st_" + i;
            assertEquals(expected, cache(0).get(i));
            assertEquals("after_st_" + i, cache(2).get(i));
View Full Code Here

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

               owners++;
            }
            if (dc2.get(i) != null) {
               owners++;
            }
            assertEquals("Wrong number of owners", ch.locateOwners(i).size(), owners);

            String expected = "before_st_" + i;
            assertEquals(expected, cache(0).get(i));
            assertEquals(expected, cache(2).get(i));
         }
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.