populate DevicePorts on activate
Change-Id: If716b27fb13dcd64021cf56a0a49b76bc2258a5e
Showing
1 changed file
with
11 additions
and
7 deletions
... | @@ -95,6 +95,7 @@ public class DistributedDeviceStore | ... | @@ -95,6 +95,7 @@ public class DistributedDeviceStore |
95 | rawDevicePorts.addEntryListener(new RemotePortEventHandler(devicePorts), includeValue); | 95 | rawDevicePorts.addEntryListener(new RemotePortEventHandler(devicePorts), includeValue); |
96 | 96 | ||
97 | loadDeviceCache(); | 97 | loadDeviceCache(); |
98 | + loadDevicePortsCache(); | ||
98 | 99 | ||
99 | log.info("Started"); | 100 | log.info("Started"); |
100 | } | 101 | } |
... | @@ -122,13 +123,16 @@ public class DistributedDeviceStore | ... | @@ -122,13 +123,16 @@ public class DistributedDeviceStore |
122 | } | 123 | } |
123 | 124 | ||
124 | private void loadDeviceCache() { | 125 | private void loadDeviceCache() { |
125 | - log.info("{}:{}", rawDevices.size(), devices.size()); | 126 | + for (byte[] keyBytes : rawDevices.keySet()) { |
126 | - if (rawDevices.size() != devices.size()) { | 127 | + final DeviceId id = deserialize(keyBytes); |
127 | - for (Map.Entry<byte[], byte[]> e : rawDevices.entrySet()) { | 128 | + devices.refresh(id); |
128 | - final DeviceId key = deserialize(e.getKey()); | 129 | + } |
129 | - final DefaultDevice val = deserialize(e.getValue()); | 130 | + } |
130 | - devices.put(key, Optional.of(val)); | 131 | + |
131 | - } | 132 | + private void loadDevicePortsCache() { |
133 | + for (byte[] keyBytes : rawDevicePorts.keySet()) { | ||
134 | + final DeviceId id = deserialize(keyBytes); | ||
135 | + devicePorts.refresh(id); | ||
132 | } | 136 | } |
133 | } | 137 | } |
134 | 138 | ... | ... |
-
Please register or login to post a comment