Update Patterns.ask() interactions
[netconf.git] / netconf / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / impl / NetconfNodeManager.java
index 61eb8e9e21f68408e3d52d2ead3ef0e2654b7b67..f1836b3cb77fc941667d5b42e27cecc0fb8ac250 100644 (file)
@@ -38,11 +38,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
-import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceRegistry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import scala.concurrent.Future;
 
 /**
  * Managing and reacting on data tree changes in specific netconf node when master writes status to the operational
@@ -55,8 +52,6 @@ class NetconfNodeManager
 
     private final Timeout actorResponseWaitTime;
     private final DOMMountPointService mountPointService;
-    private final SchemaSourceRegistry schemaRegistry;
-    private final SchemaRepository schemaRepository;
 
     private volatile NetconfTopologySetup setup;
     private volatile ListenerRegistration<NetconfNodeManager> dataChangeListenerRegistration;
@@ -76,8 +71,6 @@ class NetconfNodeManager
                        final DOMMountPointService mountPointService) {
         this.setup = setup;
         this.id = id;
-        this.schemaRegistry = setup.getSchemaResourcesDTO().getSchemaRegistry();
-        this.schemaRepository = setup.getSchemaResourcesDTO().getSchemaRepository();
         this.actorResponseWaitTime = actorResponseWaitTime;
         this.mountPointService = mountPointService;
     }
@@ -182,8 +175,7 @@ class NetconfNodeManager
     @Holding("this")
     private void sendAskForMasterMountPointWithRetries(final AskForMasterMountPoint askForMasterMountPoint,
             final ActorSelection masterActor, final int tries, final int updateCount) {
-        final Future<Object> future = Patterns.ask(masterActor, askForMasterMountPoint, actorResponseWaitTime);
-        future.onComplete(new OnComplete<Object>() {
+        Patterns.ask(masterActor, askForMasterMountPoint, actorResponseWaitTime).onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object response) {
                 synchronized (this) {
@@ -197,10 +189,10 @@ class NetconfNodeManager
                             LOG.warn("{}: Failed to send message to {} - retrying...", id, masterActor, failure);
                         }
                         sendAskForMasterMountPointWithRetries(askForMasterMountPoint, masterActor, tries + 1,
-                                updateCount);
+                            updateCount);
                     } else if (failure != null) {
                         LOG.error("{}: Failed to send message {} to {}. Slave mount point could not be created",
-                                id, askForMasterMountPoint, masterActor, failure);
+                            id, askForMasterMountPoint, masterActor, failure);
                     } else {
                         LOG.debug("{}: {} message to {} succeeded", id, askForMasterMountPoint, masterActor);
                     }
@@ -212,13 +204,11 @@ class NetconfNodeManager
     @Holding("this")
     private void createOrUpdateActorRef() {
         if (slaveActorRef == null) {
-            slaveActorRef = setup.getActorSystem().actorOf(NetconfNodeActor.props(setup, id, schemaRegistry,
-                    schemaRepository, actorResponseWaitTime, mountPointService));
+            slaveActorRef = setup.getActorSystem().actorOf(NetconfNodeActor.props(setup, id, actorResponseWaitTime,
+                    mountPointService));
             LOG.debug("{}: Slave actor created with name {}", id, slaveActorRef);
         } else {
-            slaveActorRef
-                    .tell(new RefreshSlaveActor(setup, id, schemaRegistry, schemaRepository, actorResponseWaitTime),
-                            ActorRef.noSender());
+            slaveActorRef.tell(new RefreshSlaveActor(setup, id, actorResponseWaitTime), ActorRef.noSender());
         }
     }