- futures.add(delegateTopologyHandler.onNodeUpdated(nodeId, node));
- for (TopologyManager topologyManager : peers.values()) {
- // convert binding into NormalizedNode for transfer
- final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = codecRegistry.toNormalizedNode(getNodeIid(topologyId), node);
-
- // add a future into our futures that gets its completion status from the converted scala future
- final SettableFuture<Node> settableFuture = SettableFuture.create();
- futures.add(settableFuture);
- final Future<NormalizedNodeMessage> scalaFuture = topologyManager.onRemoteNodeUpdated(new NormalizedNodeMessage(normalizedNodeEntry.getKey(), normalizedNodeEntry.getValue()));
- scalaFuture.onComplete(new OnComplete<NormalizedNodeMessage>() {
- @Override
- public void onComplete(Throwable failure, NormalizedNodeMessage success) throws Throwable {
- if (failure != null) {
- settableFuture.setException(failure);
- return;
+ // first cleanup old node
+ final ListenableFuture<Void> deleteFuture = onNodeDeleted(nodeId);
+ final SettableFuture<Node> createFuture = SettableFuture.create();
+ final TopologyManager selfProxy = TypedActor.self();
+ final ActorContext context = TypedActor.context();
+ Futures.addCallback(deleteFuture, new FutureCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ LOG.warn("Delete part of update succesfull, triggering create");
+ // trigger create on all nodes
+ Futures.addCallback(selfProxy.onNodeCreated(nodeId, node), new FutureCallback<Node>() {
+ @Override
+ public void onSuccess(Node result) {
+ createFuture.set(result);