Package org.infinispan.distribution

Examples of org.infinispan.distribution.DistributionManager.locate()


   protected <K> Map<Address, List<K>> mapKeysToNodes(K... input) {
      DistributionManager dm = cache.getDistributionManager();
      Map<Address, List<K>> addressToKey = new HashMap<Address, List<K>>();
      for (K key : input) {
         List<Address> nodesForKey = dm.locate(key);
         Address ownerOfKey = nodesForKey.get(0);
         List<K> keysAtNode = addressToKey.get(ownerOfKey);
         if (keysAtNode == null) {
            keysAtNode = new ArrayList<K>();
            addressToKey.put(ownerOfKey, keysAtNode);
View Full Code Here


            // since keys and values are on all nodes, lets just pick randomly
            Collections.shuffle(members);
            ownerOfKey = members.get(0);
         } else {
            // DIST mode
            List<Address> owners = dm.locate(key);
            List<Address> filtered = filterMembers(policy, owners);
            if(!filtered.isEmpty()){
               ownerOfKey = filtered.get(0);
            } else {
               ownerOfKey = owners.get(0);
View Full Code Here

        List<Address> addresses = Arrays.asList(address1, address2, localAddress);

        when(this.cache.getAdvancedCache()).thenReturn(this.cache);
        when(this.cache.getDistributionManager()).thenReturn(distManager);
        when(distManager.getLocality(sessionId)).thenReturn(DataLocality.LOCAL);
        when(distManager.locate(same(sessionId))).thenReturn(addresses);
        when(this.cache.getCacheManager()).thenReturn(container);
        when(container.getAddress()).thenReturn(address2);
        when(this.sessionManager.getJvmRoute()).thenReturn(expected);

        result = this.manager.locate(sessionId);
View Full Code Here

        ArgumentCaptor<Address> capturedAddress = ArgumentCaptor.forClass(Address.class);

        when(this.cache.getAdvancedCache()).thenReturn(this.cache);
        when(this.cache.getDistributionManager()).thenReturn(distManager);
        when(distManager.getLocality(sessionId)).thenReturn(DataLocality.NOT_LOCAL);
        when(distManager.locate(same(sessionId))).thenReturn(addresses);
        when(this.cache.getCacheManager()).thenReturn(container);
        when(container.getAddress()).thenReturn(localAddress);
        when(this.registry.getRemoteEntry(capturedAddress.capture())).thenReturn(new AbstractMap.SimpleImmutableEntry<String, Void>(expected, null));
        when(this.cache.withFlags(Flag.FORCE_SYNCHRONOUS)).thenReturn(this.cache);
View Full Code Here

            // since keys and values are on all nodes, lets just pick randomly
            Collections.shuffle(members);
            ownerOfKey = members.get(0);
         } else {
            // DIST mode
            List<Address> owners = dm.locate(key);
            List<Address> filtered = filterMembers(policy, owners);
            if(!filtered.isEmpty()){
               ownerOfKey = filtered.get(0);
            } else {
               ownerOfKey = owners.get(0);
View Full Code Here

         }
      }
      DistributionManager distributionManager = cache.getAdvancedCache().getDistributionManager();
      if(distributionManager!=null) {
         Object key = keyData.getKey();
         List<Address> addresses = distributionManager.locate(codec.encodeKey(key));
         return new StringResult(addresses.toString());
      } else {
         throw log.cacheNotDistributed();
      }
   }
View Full Code Here

            // since keys and values are on all nodes, lets just pick randomly
            Collections.shuffle(members);
            ownerOfKey = members.get(0);
         } else {
            // DIST mode
            List<Address> owners = dm.locate(key);
            List<Address> filtered = filterMembers(policy, owners);
            if(!filtered.isEmpty()){
               ownerOfKey = filtered.get(0);
            } else {
               ownerOfKey = owners.get(0);
View Full Code Here

   protected <K> Map<Address, List<K>> mapKeysToNodes(K... input) {
      DistributionManager dm = cache.getDistributionManager();
      Map<Address, List<K>> addressToKey = new HashMap<Address, List<K>>();
      for (K key : input) {
         List<Address> nodesForKey = dm.locate(key);
         Address ownerOfKey = nodesForKey.get(0);
         List<K> keysAtNode = addressToKey.get(ownerOfKey);
         if (keysAtNode == null) {
            keysAtNode = new ArrayList<K>();
            addressToKey.put(ownerOfKey, keysAtNode);
View Full Code Here

      if ((manager != null) && !manager.isRehashInProgress())
      {
         EmbeddedCacheManager container = (EmbeddedCacheManager) cache.getCacheManager();
         Cache<Address, String> jvmRouteCache = getJvmRouteCache(container, this.manager);
        
         for (Address address: manager.locate(sessionId))
         {
            String jvmRoute = jvmRouteCache.get(address);
           
            if (jvmRoute != null)
            {
View Full Code Here

            // since keys and values are on all nodes, lets just pick randomly
            Collections.shuffle(members);
            ownerOfKey = members.get(0);
         } else {
            // DIST mode
            List<Address> owners = dm.locate(key);
            List<Address> filtered = filterMembers(policy, owners);
            if(!filtered.isEmpty()){
               ownerOfKey = filtered.get(0);
            } else {
               ownerOfKey = owners.get(0);
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.