Package org.infinispan.topology

Examples of org.infinispan.topology.DefaultRebalancePolicy


   public static void waitForRehashToComplete(Cache... caches) {
      int gracetime = 90000; // 90 seconds
      long giveup = System.currentTimeMillis() + gracetime;
      for (Cache c : caches) {
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean chIsBalanced = !rebalanceInProgress && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;

            if (System.currentTimeMillis() > giveup) {
View Full Code Here


      for (Cache c : caches) {
         if (c instanceof SecureCacheImpl) {
            c = (Cache) extractField(SecureCacheImpl.class, c, "delegate");
         }
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean currentChIsBalanced = rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chIsBalanced = !rebalanceInProgress && currentChIsBalanced;
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;
View Full Code Here

   public static void waitForRehashToComplete(Cache... caches) {
      int gracetime = 90000; // 90 seconds
      long giveup = System.currentTimeMillis() + gracetime;
      for (Cache c : caches) {
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean chIsBalanced = !rebalanceInProgress && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;

            if (System.currentTimeMillis() > giveup) {
View Full Code Here

      else if (componentType.equals(LocalTopologyManager.class))
         return (T) new LocalTopologyManagerImpl();
      else if (componentType.equals(ClusterTopologyManager.class))
         return (T) new ClusterTopologyManagerImpl();
      else if (componentType.equals(RebalancePolicy.class))
         return (T) new DefaultRebalancePolicy();
      else if (componentType.equals(BackupReceiverRepository.class))
         return (T) new BackupReceiverRepositoryImpl();
      else if (componentType.equals(CancellationService.class))
         return (T) new CancellationServiceImpl();
View Full Code Here

         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         // HACK: We need to return only after all entries have been transferred/invalidated,
         // and StateTransferManager.isStateTransferInProgress() doesn't do that.
         StateConsumer stateConsumer = extractComponent(c, StateConsumer.class);
         StateTransferLock stateTransferLock = extractComponent(c, StateTransferLock.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            boolean chIsBalanced = cacheTopology.getPendingCH() == null && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            if (chContainsAllMembers && chIsBalanced) {
               // This is the part where we wait for the old entries to be invalidated
               // because the "transaction data received" flag is only set after the invalidation.
               try {
                  stateTransferLock.waitForTransactionData(cacheTopology.getTopologyId());
View Full Code Here

      else if (componentType.equals(LocalTopologyManager.class))
         return (T) new LocalTopologyManagerImpl();
      else if (componentType.equals(ClusterTopologyManager.class))
         return (T) new ClusterTopologyManagerImpl();
      else if (componentType.equals(RebalancePolicy.class))
         return (T) new DefaultRebalancePolicy();
      else if (componentType.equals(BackupReceiverRepository.class))
         return (T) new BackupReceiverRepositoryImpl();
      else if (componentType.equals(CancellationService.class))
         return (T) new CancellationServiceImpl();
      else if (componentType.equals(TimeService.class)) {
View Full Code Here

   public static void waitForRehashToComplete(Cache... caches) {
      int gracetime = 90000; // 90 seconds
      long giveup = System.currentTimeMillis() + gracetime;
      for (Cache c : caches) {
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean chIsBalanced = !rebalanceInProgress && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;

            if (System.currentTimeMillis() > giveup) {
View Full Code Here

      addClusterEnabledCacheManager(cacheConfigBuilder);
      waitForClusterToForm();

      TestingUtil.replaceComponent(manager(0), RebalancePolicy.class,
            new DefaultRebalancePolicy() {
               @Override
               public void updateCacheStatus(String cacheName, ClusterCacheStatus cacheStatus) throws Exception {
                  if (cacheStatus.getCacheTopology().getPendingCH() != null) {
                     // block the rebalance until the test reaches the desired spot
                     try {
View Full Code Here

   public static void waitForRehashToComplete(Cache... caches) {
      int gracetime = 90000; // 90 seconds
      long giveup = System.currentTimeMillis() + gracetime;
      for (Cache c : caches) {
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean chIsBalanced = !rebalanceInProgress && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;

            if (System.currentTimeMillis() > giveup) {
View Full Code Here

   public static void waitForRehashToComplete(Cache... caches) {
      int gracetime = 90000; // 90 seconds
      long giveup = System.currentTimeMillis() + gracetime;
      for (Cache c : caches) {
         StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
         DefaultRebalancePolicy rebalancePolicy = (DefaultRebalancePolicy) TestingUtil.extractGlobalComponent(c.getCacheManager(), RebalancePolicy.class);
         Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
         while (true) {
            CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
            boolean rebalanceInProgress = stateTransferManager.isStateTransferInProgress();
            boolean chIsBalanced = !rebalanceInProgress && rebalancePolicy.isBalanced(cacheTopology.getCurrentCH());
            boolean chContainsAllMembers = cacheTopology.getCurrentCH().getMembers().size() == caches.length;
            if (chIsBalanced && chContainsAllMembers)
               break;

            if (System.currentTimeMillis() > giveup) {
View Full Code Here

TOP

Related Classes of org.infinispan.topology.DefaultRebalancePolicy

Copyright © 2018 www.massapicom. 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.