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);

            // 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

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

   }

   public static boolean hasOwners(Object key, Cache<?, ?> primaryOwner, Cache<?, ?>... backupOwners) {
      ConsistentHash consistentHash = primaryOwner.getAdvancedCache().getComponentRegistry().getStateTransferManager()
            .getCacheTopology().getWriteConsistentHash();
      List<Address> ownerAddresses = consistentHash.locateOwners(key);
      if (!addressOf(primaryOwner).equals(ownerAddresses.get(0)))
         return false;
      for (Cache<?, ?> backupOwner : backupOwners) {
         if (!ownerAddresses.contains(addressOf(backupOwner)))
            return false;
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()

      ConsistentHash ch = BaseDistFunctionalTest.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 = BaseDistFunctionalTest.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()

               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
            assertEquals("after_st_" + i, 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);

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

      if (entry == null || entry.isNull()) {
         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", toStr(key), rpcManager.getAddress(), ch.locateOwners(key));
         }
      }
      return shouldFetchFromRemote;
   }
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.