@Test public void stats_have_not_changed_if_not_all_distributors_are_updated() { Fixture f = Fixture.empty(); assertFalse(f.statsHaveChanged()); }
public boolean statsHaveChanged() { if (!aggregatedStats.hasUpdatesFromAllDistributors()) { return false; } for (Iterator<ContentNodeStats> itr = aggregatedStats.getStats().iterator(); itr.hasNext(); ) { int nodeIndex = itr.next().getNodeIndex(); boolean currValue = mayHaveMergesPendingInGlobalSpace(nodeIndex); Boolean prevValue = prevMayHaveMergesPendingInGlobalSpace(nodeIndex); if (prevValue != null) { if (prevValue != currValue) { return true; } } else { return true; } } return false; }
ClusterStatsChangeTracker { public boolean statsHaveChanged() { if (!aggregatedStats.hasUpdatesFromAllDistributors()) { return false; } for (Iterator<ContentNodeStats> itr = aggregatedStats.getStats().iterator(); itr.hasNext(); ) { int nodeIndex = itr.next().getNodeIndex(); boolean currValue = mayHaveMergesPendingInGlobalSpace(nodeIndex); Boolean prevValue = prevMayHaveMergesPendingInGlobalSpace(nodeIndex); if (prevValue != null) { if (prevValue != currValue) { return true; } } else { return true; } } return false; } }
ClusterStatsChangeTracker { public boolean statsHaveChanged() { if (!aggregatedStats.hasUpdatesFromAllDistributors()) { return false; } for (Iterator<ContentNodeStats> itr = aggregatedStats.getStats().iterator(); itr.hasNext(); ) { int nodeIndex = itr.next().getNodeIndex(); boolean currValue = mayHaveMergesPendingInGlobalSpace(nodeIndex); Boolean prevValue = prevMayHaveMergesPendingInGlobalSpace(nodeIndex); if (prevValue != null) { if (prevValue != currValue) { return true; } } else { return true; } } return false; } ClusterStatsChangeTracker(AggregatedClusterStats aggregatedStats,
                                     double minMergeCompletionRatio); }
ClusterStatsChangeTracker { public boolean statsHaveChanged() { if (!aggregatedStats.hasUpdatesFromAllDistributors()) { return false; } for (Iterator<ContentNodeStats> itr = aggregatedStats.getStats().iterator(); itr.hasNext(); ) { int nodeIndex = itr.next().getNodeIndex(); boolean currValue = mayHaveMergesPendingInGlobalSpace(nodeIndex); Boolean prevValue = prevMayHaveMergesPendingInGlobalSpace(nodeIndex); if (prevValue != null) { if (prevValue != currValue) { return true; } } else { return true; } } return false; } ClusterStatsChangeTracker(AggregatedClusterStats aggregatedStats,
                                     double minMergeCompletionRatio); void syncAggregatedStats(); void updateAggregatedStats(AggregatedClusterStats newAggregatedStats,
                                      double minMergeCompletionRatio); boolean statsHaveChanged(); }
ClusterStatsChangeTracker { public boolean statsHaveChanged() { if (!aggregatedStats.hasUpdatesFromAllDistributors()) { return false; } for (Iterator<ContentNodeStats> itr = aggregatedStats.getStats().iterator(); itr.hasNext(); ) { int nodeIndex = itr.next().getNodeIndex(); boolean currValue = mayHaveMergesPendingInGlobalSpace(nodeIndex); Boolean prevValue = prevMayHaveMergesPendingInGlobalSpace(nodeIndex); if (prevValue != null) { if (prevValue != currValue) { return true; } } else { return true; } } return false; } ClusterStatsChangeTracker(AggregatedClusterStats aggregatedStats,
                                     double minMergeCompletionRatio); void syncAggregatedStats(); void updateAggregatedStats(AggregatedClusterStats newAggregatedStats,
                                      double minMergeCompletionRatio); boolean statsHaveChanged();  }