diff --git a/src/main/java/com/ibm/watson/modelmesh/UpgradeTracker.java b/src/main/java/com/ibm/watson/modelmesh/UpgradeTracker.java index 69661142..6e5a2b1a 100644 --- a/src/main/java/com/ibm/watson/modelmesh/UpgradeTracker.java +++ b/src/main/java/com/ibm/watson/modelmesh/UpgradeTracker.java @@ -21,8 +21,10 @@ import org.eclipse.collections.impl.factory.primitive.ObjectLongMaps; import org.eclipse.collections.impl.map.mutable.primitive.ObjectLongHashMap; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -64,7 +66,7 @@ public PerTypeLabelStats() { } // This is accessed only by instance updater thread - private final Map upgradeTracker = new HashMap<>(1); + private final Map, PerTypeLabelStats> upgradeTracker = new HashMap<>(1); // Map from replicaset to expiry time, updated via copy-on-write by instance updater thread. // Copy-on-write since updates will be be rare and we want to optimize for reads. @@ -86,7 +88,7 @@ void instanceRemoved(String iid, InstanceRecord ir) { if (iid.length() < 7) { return; // instance ids must be of non-standard format } - PerTypeLabelStats ptls = upgradeTracker.get(ir.getLabels()); + PerTypeLabelStats ptls = upgradeTracker.get(Arrays.asList(ir.getLabels())); if (ptls == null) { return; } @@ -121,9 +123,9 @@ void instanceAdded(String iid, InstanceRecord ir) { if (iid.length() < 7) { return; // instance ids must be of non-standard format } - PerTypeLabelStats ptls = upgradeTracker.get(ir.getLabels()); + PerTypeLabelStats ptls = upgradeTracker.get(Arrays.asList(ir.getLabels())); if (ptls == null) { - upgradeTracker.put(ir.getLabels(), ptls = new PerTypeLabelStats()); + upgradeTracker.put(Arrays.asList(ir.getLabels()), ptls = new PerTypeLabelStats()); } long now = System.currentTimeMillis(); // First 6 chars of instance id comes from replicaset name