Merge "Bug 9256: Add websocket server config knob for ip"
[netconf.git] / netconf / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / impl / actors / NetconfNodeActor.java
index 4b47c9de1703be801fc10941bd7ccb929a1e708a..2e46cd4a1bfbb033f2b5948116503124eb3bf567 100644 (file)
@@ -15,6 +15,7 @@ import akka.util.Timeout;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.io.IOException;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -41,6 +42,7 @@ import org.opendaylight.netconf.topology.singleton.messages.CreateInitialMasterA
 import org.opendaylight.netconf.topology.singleton.messages.MasterActorDataInitialized;
 import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
 import org.opendaylight.netconf.topology.singleton.messages.RefreshSetupMasterActorData;
+import org.opendaylight.netconf.topology.singleton.messages.RefreshSlaveActor;
 import org.opendaylight.netconf.topology.singleton.messages.RegisterMountPoint;
 import org.opendaylight.netconf.topology.singleton.messages.UnregisterSlaveMountPoint;
 import org.opendaylight.netconf.topology.singleton.messages.YangTextSchemaSourceRequest;
@@ -74,12 +76,12 @@ public class NetconfNodeActor extends UntypedActor {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfNodeActor.class);
 
-    private final SchemaSourceRegistry schemaRegistry;
-    private final SchemaRepository schemaRepository;
-    private final Timeout actorResponseWaitTime;
     private final Duration writeTxIdleTimeout;
     private final DOMMountPointService mountPointService;
 
+    private SchemaSourceRegistry schemaRegistry;
+    private SchemaRepository schemaRepository;
+    private Timeout actorResponseWaitTime;
     private RemoteDeviceId id;
     private NetconfTopologySetup setup;
     private List<SourceIdentifier> sourceIdentifiers;
@@ -152,7 +154,7 @@ public class NetconfNodeActor extends UntypedActor {
                 final DOMDataWriteTransaction tx = deviceDataBroker.newWriteOnlyTransaction();
                 final ActorRef txActor = context().actorOf(WriteTransactionActor.props(tx, writeTxIdleTimeout));
                 sender().tell(new NewWriteTransactionReply(txActor), self());
-            } catch (final Throwable t) {
+            } catch (final Exception t) {
                 sender().tell(t, self());
             }
 
@@ -161,7 +163,7 @@ public class NetconfNodeActor extends UntypedActor {
                 final DOMDataReadWriteTransaction tx = deviceDataBroker.newReadWriteTransaction();
                 final ActorRef txActor = context().actorOf(ReadWriteTransactionActor.props(tx, writeTxIdleTimeout));
                 sender().tell(new NewReadWriteTransactionReply(txActor), self());
-            } catch (final Throwable t) {
+            } catch (final Exception t) {
                 sender().tell(t, self());
             }
         } else if (message instanceof InvokeRpcMessage) { // master
@@ -179,8 +181,14 @@ public class NetconfNodeActor extends UntypedActor {
                 slaveSalManager.close();
                 slaveSalManager = null;
             }
-
+        } else if (message instanceof RefreshSlaveActor) { //slave
+            actorResponseWaitTime = ((RefreshSlaveActor) message).getActorResponseWaitTime();
+            id = ((RefreshSlaveActor) message).getId();
+            schemaRegistry = ((RefreshSlaveActor) message).getSchemaRegistry();
+            setup = ((RefreshSlaveActor) message).getSetup();
+            schemaRepository = ((RefreshSlaveActor) message).getSchemaRepository();
         }
+
     }
 
     @Override
@@ -207,7 +215,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 sender.tell(throwable, getSelf());
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void invokeSlaveRpc(final SchemaPath schemaPath, final NormalizedNodeMessage normalizedNodeMessage,
@@ -235,7 +243,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 recipient.tell(throwable, getSelf());
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void registerSlaveMountPoint(final ActorRef masterReference) {
@@ -261,7 +269,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 LOG.error("{}: Failed to register mount point: {}", id, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private DOMRpcService getDOMRpcService(final ActorRef masterReference) {