BUG 4151 : Create a shared actor system
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcProvider.java
index a1b6286a59c764aff95d57650e4356943ea44544..8be62c482ebaeec5a52d8022201959d9dcce0d2a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
+import com.google.common.base.Preconditions;
 import java.util.Collection;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
@@ -42,10 +43,12 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext
   private final RemoteRpcProviderConfig config;
 
 
-  public RemoteRpcProvider(final ActorSystem actorSystem, final DOMRpcProviderService rpcProvisionRegistry) {
+  public RemoteRpcProvider(final ActorSystem actorSystem,
+                           final DOMRpcProviderService rpcProvisionRegistry,
+                           final RemoteRpcProviderConfig config) {
     this.actorSystem = actorSystem;
     this.rpcProvisionRegistry = rpcProvisionRegistry;
-    config = new RemoteRpcProviderConfig(actorSystem.settings().config());
+    this.config = Preconditions.checkNotNull(config);
   }
 
   @Override
@@ -78,7 +81,7 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext
     final DOMRpcService rpcService = brokerSession.getService(DOMRpcService.class);
     schemaContext = schemaService.getGlobalContext();
     rpcManager = actorSystem.actorOf(RpcManager.props(schemaContext,
-            rpcProvisionRegistry, rpcService), config.getRpcManagerName());
+            rpcProvisionRegistry, rpcService, config), config.getRpcManagerName());
     schemaListenerRegistration = schemaService.registerSchemaContextListener(this);
     LOG.debug("rpc manager started");
   }