Examples of OwnershipStatistics


Examples of org.infinispan.distribution.ch.OwnershipStatistics

   OwnershipStatistics stats;

   public TopologyAwareOwnershipStatistics(DefaultConsistentHash ch) {
      this.ch = ch;
      topologyInfo = new TopologyInfo(ch.getMembers());
      stats = new OwnershipStatistics(ch, ch.getMembers());
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.OwnershipStatistics

   OwnershipStatistics stats;

   public TopologyAwareOwnershipStatistics(DefaultConsistentHash ch) {
      this.ch = ch;
      topologyInfo = new TopologyInfo(ch.getMembers());
      stats = new OwnershipStatistics(ch, ch.getMembers());
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.OwnershipStatistics

   OwnershipStatistics stats;

   public TopologyAwareOwnershipStatistics(DefaultConsistentHash ch) {
      this.ch = ch;
      topologyInfo = new TopologyInfo(ch.getMembers(), ch.getCapacityFactors());
      stats = new OwnershipStatistics(ch, ch.getMembers());
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.OwnershipStatistics

   OwnershipStatistics stats;

   public TopologyAwareOwnershipStatistics(DefaultConsistentHash ch) {
      this.ch = ch;
      topologyInfo = new TopologyInfo(ch.getMembers());
      stats = new OwnershipStatistics(ch, ch.getMembers());
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

   OwnershipStatistics stats;

   public TopologyAwareOwnershipStatistics(DefaultConsistentHash ch) {
      this.ch = ch;
      topologyInfo = new TopologyInfo(ch.getMembers(), ch.getCapacityFactors());
      stats = new OwnershipStatistics(ch, ch.getMembers());
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

      long[] distribution = new long[LOOPS * numNodes];
      long[] distributionPrimary = new long[LOOPS * numNodes];
      int distIndex = 0;
      for (int i = 0; i < LOOPS; i++) {
         DefaultConsistentHash ch = createConsistentHash(numSegments, numOwners, numNodes);
         OwnershipStatistics stats = new OwnershipStatistics(ch, ch.getMembers());
         for (Address node : ch.getMembers()) {
            distribution[distIndex] = stats.getOwned(node);
            distributionPrimary[distIndex] = stats.getPrimaryOwned(node);
            distIndex++;
         }
      }
      Arrays.sort(distribution);
      Arrays.sort(distributionPrimary);
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

      }
   }

   private void assertPrimaryOwned(int... expectedPrimaryOwned) {
      ConsistentHash ch = cache(0).getAdvancedCache().getDistributionManager().getReadConsistentHash();
      OwnershipStatistics stats = new OwnershipStatistics(ch, ch.getMembers());
      int numNodes = expectedPrimaryOwned.length;
      for (int i = 0; i < numNodes; i++) {
         assertEquals((double) expectedPrimaryOwned[i], (double) stats.getPrimaryOwned(address(i)), 1.0);
      }
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

      }
   }

   private void assertOwned(int... expectedOwned) {
      ConsistentHash ch = cache(0).getAdvancedCache().getDistributionManager().getReadConsistentHash();
      OwnershipStatistics stats = new OwnershipStatistics(ch, ch.getMembers());
      int numNodes = expectedOwned.length;
      for (int i = 0; i < numNodes; i++) {
         assertEquals((double)expectedOwned[i], (double)stats.getOwned(address(i)), 1.0);
      }
   }
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

      long[] distribution = new long[LOOPS * numNodes];
      long[] distributionPrimary = new long[LOOPS * numNodes];
      int distIndex = 0;
      for (int i = 0; i < LOOPS; i++) {
         DefaultConsistentHash ch = createConsistentHash(numSegments, numOwners, members);
         OwnershipStatistics stats = new OwnershipStatistics(ch, ch.getMembers());
         assertEquals(numSegments * numOwners, stats.sumOwned());
         for (Address node : ch.getMembers()) {
            distribution[distIndex] = stats.getOwned(node);
            distributionPrimary[distIndex] = stats.getPrimaryOwned(node);
            distIndex++;
         }
      }
      Arrays.sort(distribution);
      Arrays.sort(distributionPrimary);
View Full Code Here

Examples of org.infinispan.distribution.ch.impl.OwnershipStatistics

      }
   }

   private void checkDistribution(ReplicatedConsistentHash ch) {
      int minSegments = Integer.MAX_VALUE, maxSegments = Integer.MIN_VALUE;
      OwnershipStatistics stats = new OwnershipStatistics(ch, ch.getMembers());
      for (Address member : ch.getMembers()) {
         int primary = stats.getPrimaryOwned(member);
         minSegments = Math.min(minSegments, primary);
         maxSegments = Math.max(maxSegments, primary);
         assertEquals(stats.getOwned(member), ch.getNumSegments());
      }
      assertTrue(maxSegments - minSegments <= 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.