Konstantinos Kanonakis
Committed by Gerrit Code Review

Fixed issue in MeterManager.java

- Added check in pushMeterMetrics method to delete Meter only when it is in the PENDING_REMOVE state
- Minor change: Corrected description in MeterId.java to indicate that MeterIds are unique only within a device

Change-Id: I40e8a0cfaa93884b026e899e9c879e22133ba63b
...@@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument; ...@@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument;
19 19
20 /** 20 /**
21 * A representation of a meter id. 21 * A representation of a meter id.
22 - * Uniquely identifies a meter system wide. 22 + * Uniquely identifies a meter in the scope of a single device.
23 */ 23 */
24 public final class MeterId { 24 public final class MeterId {
25 25
......
...@@ -222,7 +222,7 @@ public class MeterManager extends AbstractListenerProviderRegistry<MeterEvent, M ...@@ -222,7 +222,7 @@ public class MeterManager extends AbstractListenerProviderRegistry<MeterEvent, M
222 provider().performMeterOperation(m.deviceId(), 222 provider().performMeterOperation(m.deviceId(),
223 new MeterOperation(m, 223 new MeterOperation(m,
224 MeterOperation.Type.ADD)); 224 MeterOperation.Type.ADD));
225 - } else { 225 + } else if ((m.state() == MeterState.PENDING_REMOVE)) {
226 store.deleteMeterNow(m); 226 store.deleteMeterNow(m);
227 } 227 }
228 }); 228 });
......