Committed by
Gerrit Code Review
Fix type mismatch MeterId -> MeterKey
Change-Id: If405ff186b23bb6b800cff16bb49983b4661e7c3
Showing
1 changed file
with
7 additions
and
6 deletions
... | @@ -82,7 +82,7 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD | ... | @@ -82,7 +82,7 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD |
82 | private ConsistentMap<MeterKey, MeterData> meters; | 82 | private ConsistentMap<MeterKey, MeterData> meters; |
83 | private NodeId local; | 83 | private NodeId local; |
84 | 84 | ||
85 | - private MapEventListener mapListener = new InternalMapEventListener(); | 85 | + private MapEventListener<MeterKey, MeterData> mapListener = new InternalMapEventListener(); |
86 | 86 | ||
87 | private Map<MeterKey, CompletableFuture<MeterStoreResult>> futures = | 87 | private Map<MeterKey, CompletableFuture<MeterStoreResult>> futures = |
88 | Maps.newConcurrentMap(); | 88 | Maps.newConcurrentMap(); |
... | @@ -216,9 +216,10 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD | ... | @@ -216,9 +216,10 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD |
216 | meters.remove(key); | 216 | meters.remove(key); |
217 | } | 217 | } |
218 | 218 | ||
219 | - private class InternalMapEventListener implements MapEventListener<MeterId, MeterData> { | 219 | + private class InternalMapEventListener implements MapEventListener<MeterKey, MeterData> { |
220 | @Override | 220 | @Override |
221 | - public void event(MapEvent<MeterId, MeterData> event) { | 221 | + public void event(MapEvent<MeterKey, MeterData> event) { |
222 | + MeterKey key = event.key(); | ||
222 | MeterData data = event.value().value(); | 223 | MeterData data = event.value().value(); |
223 | NodeId master = mastershipService.getMasterFor(data.meter().deviceId()); | 224 | NodeId master = mastershipService.getMasterFor(data.meter().deviceId()); |
224 | switch (event.type()) { | 225 | switch (event.type()) { |
... | @@ -235,17 +236,17 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD | ... | @@ -235,17 +236,17 @@ public class DistributedMeterStore extends AbstractStore<MeterEvent, MeterStoreD |
235 | } else if (data.reason().isPresent() && local.equals(data.origin())) { | 236 | } else if (data.reason().isPresent() && local.equals(data.origin())) { |
236 | MeterStoreResult msr = MeterStoreResult.fail(data.reason().get()); | 237 | MeterStoreResult msr = MeterStoreResult.fail(data.reason().get()); |
237 | //TODO: No future -> no friend | 238 | //TODO: No future -> no friend |
238 | - futures.get(data.meter().id()).complete(msr); | 239 | + futures.get(key).complete(msr); |
239 | } | 240 | } |
240 | break; | 241 | break; |
241 | case ADDED: | 242 | case ADDED: |
242 | if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_ADD) { | 243 | if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_ADD) { |
243 | - futures.remove(data.meter().id()).complete(MeterStoreResult.success()); | 244 | + futures.remove(key).complete(MeterStoreResult.success()); |
244 | } | 245 | } |
245 | break; | 246 | break; |
246 | case REMOVED: | 247 | case REMOVED: |
247 | if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_REMOVE) { | 248 | if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_REMOVE) { |
248 | - futures.remove(data.meter().id()).complete(MeterStoreResult.success()); | 249 | + futures.remove(key).complete(MeterStoreResult.success()); |
249 | } | 250 | } |
250 | break; | 251 | break; |
251 | default: | 252 | default: | ... | ... |
-
Please register or login to post a comment