Package org.infinispan.distribution

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


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


   protected <K> Map<Address, List<K>> mapKeysToNodes(K... input) {
      DistributionManager dm = cache.getAdvancedCache().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

   protected Map<Address, List<KIn>> mapKeysToNodes() {
      DistributionManager dm = cache.getAdvancedCache().getDistributionManager();
      Map<Address, List<KIn>> addressToKey = new HashMap<Address, List<KIn>>();
      for (KIn key : keys) {
         List<Address> nodesForKey = dm.locate(key);
         Address ownerOfKey = nodesForKey.get(0);
         List<KIn> keysAtNode = addressToKey.get(ownerOfKey);
         if (keysAtNode == null) {
            keysAtNode = new ArrayList<KIn>();
            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

   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

         DistributionManager manager = cache.getDistributionManager();
        
         // If rehash is in progress, just use our jvm route - don't hold up the request
         if ((manager != null) && !manager.isRehashInProgress())
         {
            List<Address> addresses = manager.locate(sessionId);
           
            EmbeddedCacheManager container = (EmbeddedCacheManager) this.sessionCache.getCacheManager();
           
            // Prefer this node, if session happens to hash here
            if (!addresses.contains(container.getAddress()))
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

            AdvancedCache<?, ?> cache = this.sessionCache.getAdvancedCache();
            DistributionManager manager = cache.getDistributionManager();

            // If rehash is in progress, just use our jvm route - don't hold up the request
            if ((manager != null) && !manager.isRehashInProgress()) {
                List<Address> addresses = manager.locate(sessionId);

                EmbeddedCacheManager container = (EmbeddedCacheManager) this.sessionCache.getCacheManager();

                // Prefer this node, if session happens to hash here
                if (!addresses.contains(container.getAddress())) {
View Full Code Here

            AdvancedCache<?, ?> cache = this.sessionCache.getAdvancedCache();
            DistributionManager manager = cache.getDistributionManager();

            // If rehash is in progress, just use our jvm route - don't hold up the request
            if ((manager != null) && !manager.isRehashInProgress()) {
                List<Address> addresses = manager.locate(sessionId);

                EmbeddedCacheManager container = (EmbeddedCacheManager) this.sessionCache.getCacheManager();

                // Prefer this node, if session happens to hash here
                if (!addresses.contains(container.getAddress())) {
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.