Examples of ConsistentHash


Examples of org.axonframework.commandhandling.distributed.ConsistentHash

        assertTrue("Connector 2 failed to connect", connector2.awaitJoined());

        // wait for both connectors to have the same view
        waitForConnectorSync();

        ConsistentHash hashBefore = connector1.getConsistentHash();
        // secretly insert an illegal message
        channel1.getReceiver().receive(new Message(channel1.getAddress(), new IpAddress(12345),
                                  new JoinMessage(10, Collections.<String>emptySet())));
        ConsistentHash hash2After = connector1.getConsistentHash();
        assertEquals("That message should not have changed the ring", hashBefore, hash2After);
    }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

      }
   }

   @Override
   public void updateHashFunction(LinkedHashMap<InetSocketAddress,Integer> servers2HashCode, int numKeyOwners, short hashFunctionVersion, int hashSpace) {
      ConsistentHash hash = hashFactory.newConsistentHash(hashFunctionVersion);
      if (hash == null) {
         log.warn("No hash function configured for version: " + hashFunctionVersion);
      } else {
         hash.init(servers2HashCode, numKeyOwners, hashSpace);
      }
      consistentHash = hash;
   }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

      assert value.equals(s);
   }

   public void testNoChDefined() {
      ConsistentHashFactory chf = new ConsistentHashFactory();
      ConsistentHash hash = chf.newConsistentHash(1);
      assert hash != null;
      assert hash.getClass().equals(ConsistentHashV1.class);
   }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

   }

   @Override
   public void updateHashFunction(Map<SocketAddress, Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace) {
       synchronized (lock) {
         ConsistentHash hash = hashFactory.newConsistentHash(hashFunctionVersion);
         if (hash == null) {
            log.noHasHFunctionConfigured(hashFunctionVersion);
         } else {
            hash.init(servers2Hash, numKeyOwners, hashSpace);
         }
         consistentHash = hash;
      }
   }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

      final Log localLog = getLog();
      int newTopologyId = transport.readVInt();
      topologyId.set(newTopologyId);
      int numKeyOwners = transport.readUnsignedShort();
      short hashFctVersion = transport.readByte();
      ConsistentHash ch = null;
      if (hashFctVersion != 0)
         ch = transport.getTransportFactory().getConsistentHashFactory()
               .newConsistentHash(hashFctVersion);
      else
         localLog.trace("Not using a consistent hash function (hash function version == 0)");
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

   }

   @Override
   public void updateHashFunction(Map<SocketAddress, Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace) {
       synchronized (lock) {
         ConsistentHash hash = hashFactory.newConsistentHash(hashFunctionVersion);
         if (hash == null) {
            log.noHasHFunctionConfigured(hashFunctionVersion);
         } else {
            hash.init(servers2Hash, numKeyOwners, hashSpace);
         }
         consistentHash = hash;
      }
   }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

   }

   @Override
   public void updateHashFunction(Map<SocketAddress, Set<Integer>> servers2Hash, int numKeyOwners, short hashFunctionVersion, int hashSpace, byte[] cacheName) {
       synchronized (lock) {
         ConsistentHash hash = hashFactory.newConsistentHash(hashFunctionVersion);
         if (hash == null) {
            log.noHasHFunctionConfigured(hashFunctionVersion);
         } else {
            hash.init(servers2Hash, numKeyOwners, hashSpace);
         }
         consistentHashes.put(cacheName, hash);
      }
   }
View Full Code Here

Examples of org.infinispan.client.hotrod.impl.consistenthash.ConsistentHash

   }

   public Transport getTransport(byte[] key, Set<SocketAddress> failedServers, byte[] cacheName) {
      SocketAddress server;
      synchronized (lock) {
         ConsistentHash consistentHash = consistentHashes.get(cacheName);
         if (consistentHash != null) {
            server = consistentHash.getServer(key);
            if (log.isTraceEnabled()) {
               log.tracef("Using consistent hash for determining the server: " + server);
            }
         } else {
            server = getNextServer(failedServers, cacheName);
View Full Code Here

Examples of org.infinispan.distribution.ConsistentHash

      return cache.getAdvancedCache().getRpcManager().getTransport().getMembers();
   }

   private Address getAddressForKey(Object key) {
      DistributionManager distributionManager = getDistributionManager();
      ConsistentHash hash = distributionManager.getConsistentHash();
      List<Address> addressList = hash.locate(key, 1);
      if (addressList.size() == 0) {
         throw new IllegalStateException("Empty address list returned by consistent hash " + hash + " for key " + key);
      }
      return addressList.get(0);
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.ConsistentHash

      int numStartedTopologyUpdates = activeTopologyUpdates.incrementAndGet();
      if (isRebalance) {
         rebalanceInProgress.set(true);
      }
      final ConsistentHash previousCh = this.cacheTopology != null ? this.cacheTopology.getWriteConsistentHash() : null;
      // Ensures writes to the data container use the right consistent hash
      // No need for a try/finally block, since it's just an assignment
      stateTransferLock.acquireExclusiveTopologyLock();
      this.cacheTopology = cacheTopology;
      if (numStartedTopologyUpdates == 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.