commit 7b9de70416b1a03c5fc9985f9c19f4f76a190db2 Author: Karsten Loesing karsten.loesing@gmx.net Date: Fri Aug 15 11:02:42 2014 +0200
Take out an unused synchronized block.
Forgot to remove this block in 97fbdee. --- .../onionoo/updater/WeightsStatusUpdater.java | 22 +++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java index f060470..f13ad14 100644 --- a/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java @@ -87,21 +87,13 @@ public class WeightsStatusUpdater implements DescriptorListener, private void updateWeightsHistory(long validAfterMillis, long freshUntilMillis, SortedMap<String, double[]> pathSelectionWeights) { - String fingerprint = null; - double[] weights = null; - do { - fingerprint = null; - synchronized (pathSelectionWeights) { - if (!pathSelectionWeights.isEmpty()) { - fingerprint = pathSelectionWeights.firstKey(); - weights = pathSelectionWeights.remove(fingerprint); - } - } - if (fingerprint != null) { - this.addToHistory(fingerprint, validAfterMillis, - freshUntilMillis, weights); - } - } while (fingerprint != null); + for (Map.Entry<String, double[]> e + : pathSelectionWeights.entrySet()) { + String fingerprint = e.getKey(); + double[] weights = e.getValue(); + this.addToHistory(fingerprint, validAfterMillis, freshUntilMillis, + weights); + } }
private SortedMap<String, double[]> calculatePathSelectionProbabilities(