Committed by
Ray Milkey
Adding origin to IntentData copy
Change-Id: Ia7c8eab72b8cbb1c5fa7a760774b8103a408d3a4
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -45,6 +45,7 @@ import org.onosproject.store.serializers.KryoNamespaces; | ... | @@ -45,6 +45,7 @@ import org.onosproject.store.serializers.KryoNamespaces; |
45 | import org.slf4j.Logger; | 45 | import org.slf4j.Logger; |
46 | 46 | ||
47 | import java.util.ArrayList; | 47 | import java.util.ArrayList; |
48 | +import java.util.Collection; | ||
48 | import java.util.Collections; | 49 | import java.util.Collections; |
49 | import java.util.List; | 50 | import java.util.List; |
50 | import java.util.Objects; | 51 | import java.util.Objects; |
... | @@ -158,6 +159,7 @@ public class GossipIntentStore | ... | @@ -158,6 +159,7 @@ public class GossipIntentStore |
158 | if (original.installables() != null) { | 159 | if (original.installables() != null) { |
159 | result.setInstallables(original.installables()); | 160 | result.setInstallables(original.installables()); |
160 | } | 161 | } |
162 | + result.setOrigin(original.origin()); | ||
161 | return result; | 163 | return result; |
162 | } | 164 | } |
163 | 165 | ||
... | @@ -248,7 +250,7 @@ public class GossipIntentStore | ... | @@ -248,7 +250,7 @@ public class GossipIntentStore |
248 | } | 250 | } |
249 | } | 251 | } |
250 | 252 | ||
251 | - private Iterable<NodeId> getPeerNodes(Key key, IntentData data) { | 253 | + private Collection<NodeId> getPeerNodes(Key key, IntentData data) { |
252 | NodeId master = partitionService.getLeader(key); | 254 | NodeId master = partitionService.getLeader(key); |
253 | NodeId origin = (data != null) ? data.origin() : null; | 255 | NodeId origin = (data != null) ? data.origin() : null; |
254 | NodeId me = clusterService.getLocalNode().id(); | 256 | NodeId me = clusterService.getLocalNode().id(); |
... | @@ -257,7 +259,7 @@ public class GossipIntentStore | ... | @@ -257,7 +259,7 @@ public class GossipIntentStore |
257 | if (isMaster && isOrigin) { | 259 | if (isMaster && isOrigin) { |
258 | return ImmutableList.of(getRandomNode()); | 260 | return ImmutableList.of(getRandomNode()); |
259 | } else if (isMaster) { | 261 | } else if (isMaster) { |
260 | - return ImmutableList.of(origin); | 262 | + return origin != null ? ImmutableList.of(origin) : ImmutableList.of(getRandomNode()); |
261 | } else if (isOrigin) { | 263 | } else if (isOrigin) { |
262 | return ImmutableList.of(master); | 264 | return ImmutableList.of(master); |
263 | } else { | 265 | } else { | ... | ... |
-
Please register or login to post a comment