BUG 4151 : Create a shared actor system 62/27562/9
authorMoiz Raja <moraja@cisco.com>
Tue, 29 Sep 2015 03:26:38 +0000 (20:26 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 10 Oct 2015 03:25:28 +0000 (03:25 +0000)
This patch adds an ActorSystemProvider interface in clustering commons
with a method to get a shard ActorSystem instance which uses the
clustered data store configuration as it contains more configuration
options than the rpc connector which pretty much uses stock configuration.
I added a config yang to define an actor-system-provider-service.

I added the ActorSystemProvider implementation and actor-system-provider-impl
config yang in the distributed datastore bundle. I tried it in
sal-clustering-commmons originally but ran into akka errors re: missing
config properties and it also couldn't find the
ReadyLocalTransactionSerializer class. So to avoid chasing down those
errors I put the implementation in sal-distributed-datastore. I think
this makes sense as it is the prime user of the actor system.

I added a dependency for the ActorSystemProvider service in both
datastores modules so the ActorSystem is now injected in and passed
to the DistributedDataStoreFactory. The dependency was also added to the
RPC mpdule.

Elements for the new actor system provider service and impl were added to
the 05-clustering.xml file along with the wiring changes for the data
stores and RPC modules.

Change-Id: I79c14f84c992a2d5ac9c1f1856efbaeba3cc2b77
Signed-off-by: Moiz Raja <moraja@cisco.com>
30 files changed:
opendaylight/md-sal/sal-clustering-commons/pom.xml
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProviderListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractConfig.java
opendaylight/md-sal/sal-clustering-commons/src/main/yang/actor-system-provider-service.yang [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/05-clustering.xml.conf
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/yang/actor-system-provider-impl.yang [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModule.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderConfig.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStore.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Gossiper.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/yang/remote-rpc-connector.yang
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStoreTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/gossip/GossiperTest.java

index 8a32507ada77109a9e1d9ee434954be7a6bb0f98..a764f2c499dd1a2d435445b4871579c00bff8248 100644 (file)
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-parser-impl</artifactId>
     </dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-parser-impl</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-api</artifactId>
+    </dependency>
+
   </dependencies>
 
   <build>
       <plugins>
   </dependencies>
 
   <build>
       <plugins>
+          <plugin>
+              <groupId>org.opendaylight.yangtools</groupId>
+              <artifactId>yang-maven-plugin</artifactId>
+              <executions>
+                  <execution>
+                      <goals>
+                          <goal>generate-sources</goal>
+                      </goals>
+                      <configuration>
+                          <codeGenerators>
+                              <generator>
+                                  <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                                  <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+                              </generator>
+                              <generator>
+                                  <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+                                  <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+                                  <additionalConfiguration>
+                                      <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+                                  </additionalConfiguration>
+                              </generator>
+                              <generator>
+                                  <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
+                                  <outputBaseDir>target/site/models</outputBaseDir>
+                              </generator>
+                          </codeGenerators>
+                          <inspectDependencies>true</inspectDependencies>
+                      </configuration>
+                  </execution>
+              </executions>
+          </plugin>
           <plugin>
               <groupId>org.jacoco</groupId>
               <artifactId>jacoco-maven-plugin</artifactId>
           <plugin>
               <groupId>org.jacoco</groupId>
               <artifactId>jacoco-maven-plugin</artifactId>
             <configuration>
             <instructions>
                 <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
             <configuration>
             <instructions>
                 <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
-                <Export-Package>org.opendaylight.controller.cluster.*,org.opendaylight.common.actor,org.opendaylight.common.reporting,org.opendaylight.controller.protobuff.*,org.opendaylight.controller.xml.*</Export-Package>
-                <Import-Package>*</Import-Package>
             </instructions>
             </configuration>
           </plugin>
             </instructions>
             </configuration>
           </plugin>
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProvider.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProvider.java
new file mode 100644 (file)
index 0000000..31ce16a
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster;
+
+import akka.actor.ActorSystem;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+
+/**
+ * Interface that provides an akka ActorSystem instance.
+ *
+ * @author Thomas Pantelis
+ */
+public interface ActorSystemProvider {
+    /**
+     * @return the current ActorSystem.
+     */
+    @Nonnull
+    ActorSystem getActorSystem();
+
+    /**
+     * Register a listener for ActorSystem lifecycle events.
+     *
+     * @param listener the ActorSystemProviderListener to register
+     * @return a ListenerRegistration instance to be used to unregister
+     */
+    ListenerRegistration<ActorSystemProviderListener> registerActorSystemProviderListener(
+            @Nonnull ActorSystemProviderListener listener);
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProviderListener.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProviderListener.java
new file mode 100644 (file)
index 0000000..ebb66f4
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster;
+
+import akka.actor.ActorSystem;
+import java.util.EventListener;
+
+/**
+ * Listener interface for notification of ActorSystem changes from an ActorSystemProvider.
+ *
+ * @author Thomas Pantelis
+ */
+public interface ActorSystemProviderListener extends EventListener {
+    /**
+     * Method called when the current actor system is about to be shutdown.
+     */
+    void onPreShutdownActorSystem();
+
+    /**
+     * Method called when the current actor system is shutdown and a new actor system is created. This method
+     * is always preceded by a call to {@link #onPreShutdownActorSystem}.
+     *
+     * @param actorSytem the new ActorSystem
+     */
+    void onNewActorSystem(ActorSystem actorSytem);
+}
index 0f2ac854cebf3735461658b56a4767abb271eb32..1a331b7e99d28216dbad982d36916d1b5fa3d4d0 100644 (file)
@@ -11,13 +11,12 @@ package org.opendaylight.controller.cluster.common.actor;
 import com.google.common.base.Preconditions;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import com.google.common.base.Preconditions;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
-
 import java.util.HashMap;
 import java.util.Map;
 
 public abstract class AbstractConfig implements UnifiedConfig {
 
 import java.util.HashMap;
 import java.util.Map;
 
 public abstract class AbstractConfig implements UnifiedConfig {
 
-    private Config config;
+    private final Config config;
 
     public AbstractConfig(Config config){
         this.config = config;
 
     public AbstractConfig(Config config){
         this.config = config;
@@ -45,11 +44,13 @@ public abstract class AbstractConfig implements UnifiedConfig {
             return (T)this;
         }
 
             return (T)this;
         }
 
-        protected Config merge(){
-            if (fallback == null)
-                fallback = ConfigFactory.load().getConfig(actorSystemName);
+        protected Config merge() {
+            Config config = ConfigFactory.parseMap(configHolder);
+            if (fallback != null) {
+                config = config.withFallback(fallback);
+            }
 
 
-            return ConfigFactory.parseMap(configHolder).withFallback(fallback);
+            return config;
         }
     }
 }
         }
     }
 }
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/yang/actor-system-provider-service.yang b/opendaylight/md-sal/sal-clustering-commons/src/main/yang/actor-system-provider-service.yang
new file mode 100644 (file)
index 0000000..f284851
--- /dev/null
@@ -0,0 +1,18 @@
+module actor-system-provider-service {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
+    prefix "actor-system";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    description "Akka actor system provider service definition";
+
+    revision "2015-10-05" {
+        description "Initial revision";
+    }
+
+    identity actor-system-provider-service {
+        base "config:service-type";
+        config:java-class  "org.opendaylight.controller.cluster.ActorSystemProvider";
+    }
+}
\ No newline at end of file
index b706d20d1adaf1ff0419f647ae17deb056f6af7e..c027de0acf57fbeae8eeb129fc1d0a9be5921453 100644 (file)
@@ -13,14 +13,15 @@ import akka.actor.DeadLetter;
 import akka.actor.Props;
 import akka.actor.UntypedActor;
 import akka.testkit.JavaTestKit;
 import akka.actor.Props;
 import akka.actor.UntypedActor;
 import akka.testkit.JavaTestKit;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import scala.concurrent.duration.FiniteDuration;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import scala.concurrent.duration.FiniteDuration;
 
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
 public class MeteredBoundedMailboxTest {
 
     private static ActorSystem actorSystem;
 public class MeteredBoundedMailboxTest {
 
     private static ActorSystem actorSystem;
@@ -29,14 +30,20 @@ public class MeteredBoundedMailboxTest {
 
     @Before
     public void setUp() throws Exception {
 
     @Before
     public void setUp() throws Exception {
-        config = new CommonConfig.Builder<>("testsystem").build();
+        config = new CommonConfig.Builder<>("testsystem").withConfigReader(new AkkaConfigurationReader() {
+            @Override
+            public Config read() {
+                return ConfigFactory.load();
+            }
+        }).build();
         actorSystem = ActorSystem.create("testsystem", config.get());
     }
 
     @After
     public void tearDown() throws Exception {
         actorSystem = ActorSystem.create("testsystem", config.get());
     }
 
     @After
     public void tearDown() throws Exception {
-       if (actorSystem != null)
-           actorSystem.shutdown();
+       if (actorSystem != null) {
+        actorSystem.shutdown();
+    }
     }
 
     @Test
     }
 
     @Test
@@ -86,8 +93,9 @@ public class MeteredBoundedMailboxTest {
         public void onReceive(Object message) throws Exception {
             lock.lock();
             try {
         public void onReceive(Object message) throws Exception {
             lock.lock();
             try {
-                if ("ping".equals(message))
+                if ("ping".equals(message)) {
                     getSender().tell("pong", getSelf());
                     getSender().tell("pong", getSelf());
+                }
             } finally {
                 lock.unlock();
             }
             } finally {
                 lock.unlock();
             }
index df6091b015733235b5b8b3c8f1c7257d11677122..6c5e91a168cd55ee47bfc9f8091d05b7bfbc95fb 100644 (file)
                     </operational-data-store>
                 </module>
 
                     </operational-data-store>
                 </module>
 
+                <module>
+                    <type xmlns:as="urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:impl">as:actor-system-provider-impl</type>
+                    <name>actor-system-provider-impl</name>
+                </module>
+
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider">prefix:distributed-operational-datastore-provider</type>
                     <name>distributed-operational-store-module</name>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider">prefix:distributed-operational-datastore-provider</type>
                     <name>distributed-operational-store-module</name>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                         <name>yang-schema-service</name>
                     </operational-schema-service>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                         <name>yang-schema-service</name>
                     </operational-schema-service>
+                    <operational-actor-system-provider>
+                        <type xmlns:as="urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service">as:actor-system-provider-service</type>
+                        <name>actor-system-provider</name>
+                    </operational-actor-system-provider>
                     <operational-properties>
                         <persistent>false</persistent>
                         <shard-election-timeout-factor>20</shard-election-timeout-factor>
                     <operational-properties>
                         <persistent>false</persistent>
                         <shard-election-timeout-factor>20</shard-election-timeout-factor>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                         <name>yang-schema-service</name>
                     </config-schema-service>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                         <name>yang-schema-service</name>
                     </config-schema-service>
+                    <config-actor-system-provider>
+                        <type xmlns:as="urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service">as:actor-system-provider-service</type>
+                        <name>actor-system-provider</name>
+                    </config-actor-system-provider>
                     <config-properties>
                         <shard-election-timeout-factor>20</shard-election-timeout-factor>
                     </config-properties>
                     <config-properties>
                         <shard-election-timeout-factor>20</shard-election-timeout-factor>
                     </config-properties>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
                         <name>dom-broker</name>
                     </dom-broker>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
                         <name>dom-broker</name>
                     </dom-broker>
+                    <actor-system-provider>
+                        <type xmlns:as="urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service">as:actor-system-provider-service</type>
+                        <name>actor-system-provider</name>
+                    </actor-system-provider>
                     <enable-metric-capture xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">true</enable-metric-capture>
                     <enable-metric-capture xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">true</enable-metric-capture>
-                    <actor-system-name xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">odl-cluster-rpc</actor-system-name>
                     <bounded-mailbox-capacity xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">1000</bounded-mailbox-capacity>
                 </module>
 
                     <bounded-mailbox-capacity xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">1000</bounded-mailbox-capacity>
                 </module>
 
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
 
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
 
+                <service>
+                    <type xmlns:as="urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service">as:actor-system-provider-service</type>
+                    <instance>
+                        <name>actor-system-provider</name>
+                        <provider>/modules/module[type='actor-system-provider-impl'][name='actor-system-provider-impl']</provider>
+                    </instance>
+                </service>
                 <service>
                     <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
                     <instance>
                 <service>
                     <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
                     <instance>
     </configuration>
     <required-capabilities>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:concurrent-data-broker?module=odl-concurrent-data-broker-cfg&amp;revision=2014-11-24</capability>
     </configuration>
     <required-capabilities>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:concurrent-data-broker?module=odl-concurrent-data-broker-cfg&amp;revision=2014-11-24</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service?module=actor-system-provider-service&amp;revision=2015-10-05</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:impl?module=actor-system-provider-impl&amp;revision=2015-10-05</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider?module=distributed-datastore-provider&amp;revision=2014-06-12</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store?module=opendaylight-config-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider?module=distributed-datastore-provider&amp;revision=2014-06-12</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store?module=opendaylight-config-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&amp;revision=2014-06-17</capability>
index f542847fa139e814fb81424f0f22f33a5693cce7..5a6dbe587984c5310e141c79bea8d1e08f457b87 100644 (file)
@@ -71,40 +71,3 @@ odl-cluster-data {
     }
   }
 }
     }
   }
 }
-
-odl-cluster-rpc {
-  bounded-mailbox {
-    mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox"
-    mailbox-capacity = 1000
-    mailbox-push-timeout-time = 100ms
-  }
-
-  metric-capture-enabled = true
-
-  akka {
-    loglevel = "INFO"
-    loggers = ["akka.event.slf4j.Slf4jLogger"]
-    logger-startup-timeout = 300s
-
-    actor {
-      provider = "akka.cluster.ClusterActorRefProvider"
-
-    }
-    remote {
-      log-remote-lifecycle-events = off
-      netty.tcp {
-        hostname = "127.0.0.1"
-        port = 2551
-        maximum-frame-size = 419430400
-        send-buffer-size = 52428800
-        receive-buffer-size = 52428800
-      }
-    }
-
-    cluster {
-      seed-nodes = ["akka.tcp://odl-cluster-rpc@127.0.0.1:2551"]
-
-      auto-down-unreachable-after = 300s
-    }
-  }
-}
index 455b36c151d4959551ea01d503e6eb5b25a72179..49f5388842d9b690609f063842fc60ce425ec78f 100644 (file)
@@ -203,7 +203,6 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener,
 
         txContextFactory.close();
         actorContext.shutdown();
 
         txContextFactory.close();
         actorContext.shutdown();
-        DistributedDataStoreFactory.destroyInstance(this);
     }
 
     public ActorContext getActorContext() {
     }
 
     public ActorContext getActorContext() {
index 4d3854f9ef4e7dc83bde887ecceb6cf1eda604c0..25029b6f1800f099e8731e087517e0743d82518d 100644 (file)
@@ -8,31 +8,18 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
-import akka.actor.Props;
-import akka.osgi.BundleDelegatingClassLoader;
-import com.google.common.base.Preconditions;
-import com.typesafe.config.ConfigFactory;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import scala.concurrent.duration.Duration;
 
 public class DistributedDataStoreFactory {
 
 public class DistributedDataStoreFactory {
-    private static final String ACTOR_SYSTEM_NAME = "opendaylight-cluster-data";
-    private static final String CONFIGURATION_NAME = "odl-cluster-data";
-    private static ActorSystem actorSystem = null;
-    private static final Set<DistributedDataStore> createdInstances = new HashSet<>(2);
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStoreFactory.class);
 
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStoreFactory.class);
 
-    public static synchronized DistributedDataStore createInstance(SchemaService schemaService,
-            DatastoreContext datastoreContext, BundleContext bundleContext) {
+    public static DistributedDataStore createInstance(SchemaService schemaService,
+            DatastoreContext datastoreContext, ActorSystem actorSystem, BundleContext bundleContext) {
 
         LOG.info("Create data store instance of type : {}", datastoreContext.getDataStoreType());
 
 
         LOG.info("Create data store instance of type : {}", datastoreContext.getDataStoreType());
 
@@ -40,7 +27,6 @@ public class DistributedDataStoreFactory {
         DatastoreContextConfigAdminOverlay overlay = new DatastoreContextConfigAdminOverlay(
                 introspector, bundleContext);
 
         DatastoreContextConfigAdminOverlay overlay = new DatastoreContextConfigAdminOverlay(
                 introspector, bundleContext);
 
-        ActorSystem actorSystem = getActorSystem(bundleContext, datastoreContext.getConfigurationReader());
         Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
         final DistributedDataStore dataStore = new DistributedDataStore(actorSystem,
                 new ClusterWrapperImpl(actorSystem), config, introspector.getContext());
         Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
         final DistributedDataStore dataStore = new DistributedDataStore(actorSystem,
                 new ClusterWrapperImpl(actorSystem), config, introspector.getContext());
@@ -52,43 +38,6 @@ public class DistributedDataStoreFactory {
         dataStore.setCloseable(overlay);
         dataStore.waitTillReady();
 
         dataStore.setCloseable(overlay);
         dataStore.waitTillReady();
 
-        createdInstances.add(dataStore);
         return dataStore;
     }
         return dataStore;
     }
-
-    private static synchronized final ActorSystem getActorSystem(final BundleContext bundleContext,
-                                                                 AkkaConfigurationReader configurationReader) {
-        if (actorSystem == null) {
-            // Create an OSGi bundle classloader for actor system
-            BundleDelegatingClassLoader classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle(),
-                Thread.currentThread().getContextClassLoader());
-
-            actorSystem = ActorSystem.create(ACTOR_SYSTEM_NAME,
-                ConfigFactory.load(configurationReader.read()).getConfig(CONFIGURATION_NAME), classLoader);
-            actorSystem.actorOf(Props.create(TerminationMonitor.class), "termination-monitor");
-        }
-
-        return actorSystem;
-    }
-
-    public static synchronized void destroyInstance(DistributedDataStore dataStore){
-        Preconditions.checkNotNull(dataStore, "dataStore should not be null");
-
-        LOG.info("Destroy data store instance of type : {}", dataStore.getActorContext().getDataStoreType());
-
-        if(createdInstances.remove(dataStore)){
-            if(createdInstances.size() == 0){
-                if(actorSystem != null) {
-                    actorSystem.shutdown();
-                    try {
-                        actorSystem.awaitTermination(Duration.create(10, TimeUnit.SECONDS));
-                    } catch (Exception e) {
-                        LOG.warn("Error awaiting actor termination", e);
-                    }
-                    actorSystem = null;
-                }
-            }
-        }
-    }
-
 }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderImpl.java
new file mode 100644 (file)
index 0000000..22d728d
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.config.yang.config.actor_system_provider.impl;
+
+import akka.actor.ActorSystem;
+import akka.osgi.BundleDelegatingClassLoader;
+import com.typesafe.config.ConfigFactory;
+import java.util.concurrent.TimeUnit;
+import org.opendaylight.controller.cluster.ActorSystemProvider;
+import org.opendaylight.controller.cluster.ActorSystemProviderListener;
+import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
+import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.util.ListenerRegistry;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import scala.concurrent.duration.Duration;
+
+public class ActorSystemProviderImpl implements ActorSystemProvider, AutoCloseable {
+    private static final String ACTOR_SYSTEM_NAME = "opendaylight-cluster-data";
+    private static final String CONFIGURATION_NAME = "odl-cluster-data";
+    static final Logger LOG = LoggerFactory.getLogger(ActorSystemProviderImpl.class);
+
+    private ActorSystem actorSystem;
+    private final BundleDelegatingClassLoader classLoader;
+    private final ListenerRegistry<ActorSystemProviderListener> listeners = new ListenerRegistry<>();
+
+    public ActorSystemProviderImpl(BundleContext bundleContext) {
+        LOG.info("Creating new ActorSystem");
+
+        classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle(),
+                Thread.currentThread().getContextClassLoader());
+
+        createActorSystem();
+    }
+
+    private void createActorSystem() {
+        AkkaConfigurationReader configurationReader = new FileAkkaConfigurationReader();
+        actorSystem = ActorSystem.create(ACTOR_SYSTEM_NAME,
+                ConfigFactory.load(configurationReader.read()).getConfig(CONFIGURATION_NAME), classLoader);
+    }
+
+    @Override
+    public ActorSystem getActorSystem() {
+        return actorSystem;
+    }
+
+    @Override
+    public ListenerRegistration<ActorSystemProviderListener> registerActorSystemProviderListener(
+            ActorSystemProviderListener listener) {
+        return listeners.register(listener);
+    }
+
+    @Override
+    public void close() {
+        LOG.info("Shutting down ActorSystem");
+
+        actorSystem.shutdown();
+        try {
+            actorSystem.awaitTermination(Duration.create(10, TimeUnit.SECONDS));
+        } catch (Exception e) {
+            LOG.warn("Error awaiting actor termination", e);
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModule.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModule.java
new file mode 100644 (file)
index 0000000..96cb83d
--- /dev/null
@@ -0,0 +1,29 @@
+package org.opendaylight.controller.config.yang.config.actor_system_provider.impl;
+
+import org.osgi.framework.BundleContext;
+
+public class ActorSystemProviderModule extends AbstractActorSystemProviderModule {
+    private BundleContext bundleContext;
+
+    public ActorSystemProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ActorSystemProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, ActorSystemProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new ActorSystemProviderImpl(bundleContext);
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModuleFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..94042dd
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: actor-system-provider-impl yang module local name: actor-system-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Oct 06 02:11:27 EDT 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.actor_system_provider.impl;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
+import org.opendaylight.controller.config.spi.Module;
+import org.osgi.framework.BundleContext;
+
+public class ActorSystemProviderModuleFactory extends AbstractActorSystemProviderModuleFactory {
+    @Override
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName,dependencyResolver,bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+
+    @Override
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
+        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName, dependencyResolver,
+                old, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+}
index f43f13d9045941f714234f16f4630f0de15e88c9..4ad6ca7e5e69277983e37320e0a4592fda2628f0 100644 (file)
@@ -72,7 +72,7 @@ public class DistributedConfigDataStoreProviderModule extends
                 .build();
 
         return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
                 .build();
 
         return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
-                datastoreContext, bundleContext);
+                datastoreContext, getConfigActorSystemProviderDependency().getActorSystem(), bundleContext);
     }
 
     public void setBundleContext(BundleContext bundleContext) {
     }
 
     public void setBundleContext(BundleContext bundleContext) {
index 85dddde44378be768e1758255a951a6353a799f2..ef3fa45147bd7dbbd211c8f5a5b7a921d20044cc 100644 (file)
@@ -73,7 +73,7 @@ public class DistributedOperationalDataStoreProviderModule extends
                 .build();
 
         return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
                 .build();
 
         return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
-                datastoreContext, bundleContext);
+                datastoreContext, getOperationalActorSystemProviderDependency().getActorSystem(), bundleContext);
     }
 
     public void setBundleContext(BundleContext bundleContext) {
     }
 
     public void setBundleContext(BundleContext bundleContext) {
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/actor-system-provider-impl.yang b/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/actor-system-provider-impl.yang
new file mode 100644 (file)
index 0000000..75d6125
--- /dev/null
@@ -0,0 +1,26 @@
+module actor-system-provider-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:impl";
+    prefix "actor-system-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import actor-system-provider-service {prefix actor-system;}
+
+    description "Akka actor system provider implementation";
+
+    revision "2015-10-05" {
+        description "Initial revision";
+    }
+
+    identity actor-system-provider-impl {
+        base config:module-type;
+        config:provided-service actor-system:actor-system-provider-service;
+        config:java-name-prefix ActorSystemProvider;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case actor-system-provider-impl {
+            when "/config:modules/config:module/config:type = 'actor-system-provider-impl'";
+        }
+    }
+}
\ No newline at end of file
index 91c4279f24d2a30a9dc0a9baab6baa0806c8a717..b6980a659f73c2d17def6c882fe204e13bd7ab95 100644 (file)
@@ -10,6 +10,7 @@ module distributed-datastore-provider {
     import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
     import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
     import opendaylight-md-sal-dom {prefix sal;}
     import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
     import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
     import opendaylight-md-sal-dom {prefix sal;}
+    import actor-system-provider-service {prefix actor-system;}
 
     description
         "This module contains the base YANG definitions for
 
     description
         "This module contains the base YANG definitions for
@@ -241,12 +242,21 @@ module distributed-datastore-provider {
                 container config-schema-service {
                     uses config:service-ref {
                         refine type {
                 container config-schema-service {
                     uses config:service-ref {
                         refine type {
-                            mandatory false;
+                            mandatory true;
                             config:required-identity sal:schema-service;
                         }
                     }
                 }
 
                             config:required-identity sal:schema-service;
                         }
                     }
                 }
 
+                container config-actor-system-provider {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory true;
+                            config:required-identity actor-system:actor-system-provider-service;
+                        }
+                    }
+                }
+
                 container config-properties {
                     uses data-store-properties;
                 }
                 container config-properties {
                     uses data-store-properties;
                 }
@@ -260,12 +270,21 @@ module distributed-datastore-provider {
                 container operational-schema-service {
                     uses config:service-ref {
                         refine type {
                 container operational-schema-service {
                     uses config:service-ref {
                         refine type {
-                            mandatory false;
+                            mandatory true;
                             config:required-identity sal:schema-service;
                         }
                     }
                 }
 
                             config:required-identity sal:schema-service;
                         }
                     }
                 }
 
+                container operational-actor-system-provider {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory true;
+                            config:required-identity actor-system:actor-system-provider-service;
+                        }
+                    }
+                }
+
                 container operational-properties {
                     uses data-store-properties;
                 }
                 container operational-properties {
                     uses data-store-properties;
                 }
index 8bf768d6be4608cbd209b01623a0a4a2c8c2dac4..d7843eab8a65ae058899093869f3e5e394301c95 100644 (file)
@@ -1,45 +1,45 @@
 package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
 
 package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
 
-import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
+import akka.actor.ActorSystem;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderFactory;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.osgi.framework.BundleContext;
 
 public class RemoteRPCBrokerModule extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModule {
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderFactory;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.osgi.framework.BundleContext;
 
 public class RemoteRPCBrokerModule extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModule {
-  private BundleContext bundleContext;
-  public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-    super(identifier, dependencyResolver);
-  }
-
-  public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.remote_rpc_connector.RemoteRPCBrokerModule oldModule, java.lang.AutoCloseable oldInstance) {
-    super(identifier, dependencyResolver, oldModule, oldInstance);
-  }
-
-  @Override
-  public void customValidation() {
-     // add custom validation form module attributes here.
-  }
-
-  @Override
-  public boolean canReuseInstance(AbstractRemoteRPCBrokerModule oldModule) {
-      return true;
-  }
-
-  @Override
-  public java.lang.AutoCloseable createInstance() {
-    Broker broker = getDomBrokerDependency();
-
-    RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder(getActorSystemName())
-                              .metricCaptureEnabled(getEnableMetricCapture())
-                              .mailboxCapacity(getBoundedMailboxCapacity())
-                              .withConfigReader(new FileAkkaConfigurationReader())
-                              .build();
-
-    return RemoteRpcProviderFactory.createInstance(broker, bundleContext, config);
-  }
-
-  public void setBundleContext(BundleContext bundleContext) {
-    this.bundleContext = bundleContext;
-  }
+    private BundleContext bundleContext;
+    public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.remote_rpc_connector.RemoteRPCBrokerModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public boolean canReuseInstance(AbstractRemoteRPCBrokerModule oldModule) {
+        return true;
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        Broker broker = getDomBrokerDependency();
+
+        ActorSystem actorSystem = getActorSystemProviderDependency().getActorSystem();
+        RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder(actorSystem.name())
+                .metricCaptureEnabled(getEnableMetricCapture())
+                .mailboxCapacity(getBoundedMailboxCapacity())
+                .build();
+
+        return RemoteRpcProviderFactory.createInstance(broker, bundleContext, actorSystem, config);
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
 }
 }
index a1b6286a59c764aff95d57650e4356943ea44544..8be62c482ebaeec5a52d8022201959d9dcce0d2a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 
 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;
 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;
 
 
   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;
     this.actorSystem = actorSystem;
     this.rpcProvisionRegistry = rpcProvisionRegistry;
-    config = new RemoteRpcProviderConfig(actorSystem.settings().config());
+    this.config = Preconditions.checkNotNull(config);
   }
 
   @Override
   }
 
   @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,
     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");
   }
     schemaListenerRegistration = schemaService.registerSchemaContextListener(this);
     LOG.debug("rpc manager started");
   }
index 3f6d42d7422fd3d06d71e921cbf691d43dd1ed8a..6f3a10e6484cb115b1028dc83fa4f6c2063c1883 100644 (file)
@@ -9,11 +9,10 @@ package org.opendaylight.controller.remote.rpc;
 
 import akka.util.Timeout;
 import com.typesafe.config.Config;
 
 import akka.util.Timeout;
 import com.typesafe.config.Config;
+import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.common.actor.CommonConfig;
 import scala.concurrent.duration.FiniteDuration;
 
 import org.opendaylight.controller.cluster.common.actor.CommonConfig;
 import scala.concurrent.duration.FiniteDuration;
 
-import java.util.concurrent.TimeUnit;
-
 /**
  */
 public class RemoteRpcProviderConfig extends CommonConfig {
 /**
  */
 public class RemoteRpcProviderConfig extends CommonConfig {
index 83101a77b8956fa6d428e0c2559300272b8c7fc6..af36b8afc9b982b82fbb389111fb70821bd52aa6 100644 (file)
@@ -9,43 +9,17 @@
 package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorSystem;
 package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorSystem;
-import akka.osgi.BundleDelegatingClassLoader;
-import com.typesafe.config.Config;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.osgi.framework.BundleContext;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class RemoteRpcProviderFactory {
 
 public class RemoteRpcProviderFactory {
-    private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProviderFactory.class);
+    public static RemoteRpcProvider createInstance(final Broker broker, final BundleContext bundleContext,
+            final ActorSystem actorSystem, final RemoteRpcProviderConfig config) {
 
 
-    public static RemoteRpcProvider createInstance(
-            final Broker broker, final BundleContext bundleContext, final RemoteRpcProviderConfig config){
+        final RemoteRpcProvider rpcProvider = new RemoteRpcProvider(actorSystem, (DOMRpcProviderService) broker, config);
 
 
-      final RemoteRpcProvider rpcProvider =
-          new RemoteRpcProvider(createActorSystem(bundleContext, config), (DOMRpcProviderService) broker);
-
-      broker.registerProvider(rpcProvider);
-      return rpcProvider;
-    }
-
-    private static ActorSystem createActorSystem(final BundleContext bundleContext, final RemoteRpcProviderConfig config){
-
-        // Create an OSGi bundle classloader for actor system
-        final BundleDelegatingClassLoader classLoader =
-                new BundleDelegatingClassLoader(bundleContext.getBundle(),
-                        Thread.currentThread().getContextClassLoader());
-
-        final Config actorSystemConfig = config.get();
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Actor system configuration\n{}", actorSystemConfig.root().render());
-        }
-        if (config.isMetricCaptureEnabled()) {
-            LOG.info("Instrumentation is enabled in actor system {}. Metrics can be viewed in JMX console.",
-                    config.getActorSystemName());
-        }
-
-        return ActorSystem.create(config.getActorSystemName(), actorSystemConfig, classLoader);
+        broker.registerProvider(rpcProvider);
+        return rpcProvider;
     }
 }
     }
 }
index 1ade84bd0fc1bee9fb8ad8db9ac33939cf591422..fc75ea6089d0e045fb431cb1ff8caa55e532ca2a 100644 (file)
@@ -55,11 +55,12 @@ public class RpcManager extends AbstractUntypedActor {
 
     private RpcManager(final SchemaContext schemaContext,
                        final DOMRpcProviderService rpcProvisionRegistry,
 
     private RpcManager(final SchemaContext schemaContext,
                        final DOMRpcProviderService rpcProvisionRegistry,
-                       final DOMRpcService rpcSevices) {
+                       final DOMRpcService rpcSevices,
+                       final RemoteRpcProviderConfig config) {
         this.schemaContext = schemaContext;
         this.rpcProvisionRegistry = rpcProvisionRegistry;
         rpcServices = rpcSevices;
         this.schemaContext = schemaContext;
         this.rpcProvisionRegistry = rpcProvisionRegistry;
         rpcServices = rpcSevices;
-        config = new RemoteRpcProviderConfig(getContext().system().settings().config());
+        this.config = config;
 
         createRpcActors();
         startListeners();
 
         createRpcActors();
         startListeners();
@@ -67,18 +68,19 @@ public class RpcManager extends AbstractUntypedActor {
 
 
       public static Props props(final SchemaContext schemaContext,
 
 
       public static Props props(final SchemaContext schemaContext,
-              final DOMRpcProviderService rpcProvisionRegistry, final DOMRpcService rpcServices) {
+              final DOMRpcProviderService rpcProvisionRegistry, final DOMRpcService rpcServices,
+              final RemoteRpcProviderConfig config) {
           Preconditions.checkNotNull(schemaContext, "SchemaContext can not be null!");
           Preconditions.checkNotNull(rpcProvisionRegistry, "RpcProviderService can not be null!");
           Preconditions.checkNotNull(rpcServices, "RpcService can not be null!");
           Preconditions.checkNotNull(schemaContext, "SchemaContext can not be null!");
           Preconditions.checkNotNull(rpcProvisionRegistry, "RpcProviderService can not be null!");
           Preconditions.checkNotNull(rpcServices, "RpcService can not be null!");
-          return Props.create(RpcManager.class, schemaContext, rpcProvisionRegistry, rpcServices);
+          return Props.create(RpcManager.class, schemaContext, rpcProvisionRegistry, rpcServices, config);
       }
 
     private void createRpcActors() {
         LOG.debug("Create rpc registry and broker actors");
 
         rpcRegistry =
       }
 
     private void createRpcActors() {
         LOG.debug("Create rpc registry and broker actors");
 
         rpcRegistry =
-                getContext().actorOf(RpcRegistry.props().
+                getContext().actorOf(RpcRegistry.props(config).
                     withMailbox(config.getMailBoxName()), config.getRpcRegistryName());
 
         rpcBroker =
                     withMailbox(config.getMailBoxName()), config.getRpcRegistryName());
 
         rpcBroker =
index 1dcc4e140595250a0414eba706eada3e776f4ece..c2ff0456f7cd04b5da3289a70a4fdf29bce84bc3 100644 (file)
@@ -15,6 +15,7 @@ import akka.japi.Pair;
 import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.List;
 import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.List;
+import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.FindRouters;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.FindRouters;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
@@ -34,12 +35,13 @@ import org.opendaylight.controller.sal.connector.api.RpcRouter.RouteIdentifier;
  */
 public class RpcRegistry extends BucketStore<RoutingTable> {
 
  */
 public class RpcRegistry extends BucketStore<RoutingTable> {
 
-    public RpcRegistry() {
+    public RpcRegistry(RemoteRpcProviderConfig config) {
+        super(config);
         getLocalBucket().setData(new RoutingTable());
     }
 
         getLocalBucket().setData(new RoutingTable());
     }
 
-    public static Props props() {
-        return Props.create(new RpcRegistryCreator());
+    public static Props props(RemoteRpcProviderConfig config) {
+        return Props.create(new RpcRegistryCreator(config));
     }
 
     @Override
     }
 
     @Override
@@ -231,10 +233,15 @@ public class RpcRegistry extends BucketStore<RoutingTable> {
 
     private static class RpcRegistryCreator implements Creator<RpcRegistry> {
         private static final long serialVersionUID = 1L;
 
     private static class RpcRegistryCreator implements Creator<RpcRegistry> {
         private static final long serialVersionUID = 1L;
+        private final RemoteRpcProviderConfig config;
+
+        private RpcRegistryCreator(RemoteRpcProviderConfig config) {
+            this.config = config;
+        }
 
         @Override
         public RpcRegistry create() throws Exception {
 
         @Override
         public RpcRegistry create() throws Exception {
-            RpcRegistry registry =  new RpcRegistry();
+            RpcRegistry registry =  new RpcRegistry(config);
             RemoteRpcRegistryMXBean mxBean = new RemoteRpcRegistryMXBeanImpl(registry);
             return registry;
         }
             RemoteRpcRegistryMXBean mxBean = new RemoteRpcRegistryMXBeanImpl(registry);
             return registry;
         }
index febff0bc92efc4c8ad896a92e3d367156c6fd345..d349035b3c62f40743ca7fd8da898d39b6bce147 100644 (file)
@@ -13,6 +13,7 @@ import akka.actor.ActorRefProvider;
 import akka.actor.Address;
 import akka.actor.Props;
 import akka.cluster.ClusterActorRefProvider;
 import akka.actor.Address;
 import akka.actor.Props;
 import akka.cluster.ClusterActorRefProvider;
+import com.google.common.base.Preconditions;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -68,8 +69,8 @@ public class BucketStore<T extends Copier<T>> extends AbstractUntypedActorWithMe
 
     private final RemoteRpcProviderConfig config;
 
 
     private final RemoteRpcProviderConfig config;
 
-    public BucketStore(){
-        config = new RemoteRpcProviderConfig(getContext().system().settings().config());
+    public BucketStore(RemoteRpcProviderConfig config){
+        this.config = Preconditions.checkNotNull(config);
     }
 
     @Override
     }
 
     @Override
@@ -78,7 +79,7 @@ public class BucketStore<T extends Copier<T>> extends AbstractUntypedActorWithMe
         selfAddress = provider.getDefaultAddress();
 
         if ( provider instanceof ClusterActorRefProvider) {
         selfAddress = provider.getDefaultAddress();
 
         if ( provider instanceof ClusterActorRefProvider) {
-            getContext().actorOf(Props.create(Gossiper.class).withMailbox(config.getMailBoxName()), "gossiper");
+            getContext().actorOf(Props.create(Gossiper.class, config).withMailbox(config.getMailBoxName()), "gossiper");
         }
     }
 
         }
     }
 
index e45950d1cae329d225cac3a9d51943fb1e716f8c..f597c316e5cdfda042fef8f6ea12741a905b20cf 100644 (file)
@@ -18,6 +18,7 @@ import akka.cluster.ClusterEvent;
 import akka.cluster.Member;
 import akka.dispatch.Mapper;
 import akka.pattern.Patterns;
 import akka.cluster.Member;
 import akka.dispatch.Mapper;
 import akka.pattern.Patterns;
+import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -77,10 +78,10 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
 
     private Boolean autoStartGossipTicks = true;
 
 
     private Boolean autoStartGossipTicks = true;
 
-    private RemoteRpcProviderConfig config;
+    private final RemoteRpcProviderConfig config;
 
 
-    public Gossiper(){
-        config = new RemoteRpcProviderConfig(getContext().system().settings().config());
+    public Gossiper(RemoteRpcProviderConfig config){
+        this.config = Preconditions.checkNotNull(config);
     }
 
     /**
     }
 
     /**
@@ -88,7 +89,8 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
      * @param autoStartGossipTicks used for turning off gossip ticks during testing.
      *                             Gossip tick can be manually sent.
      */
      * @param autoStartGossipTicks used for turning off gossip ticks during testing.
      *                             Gossip tick can be manually sent.
      */
-    public Gossiper(Boolean autoStartGossipTicks){
+    public Gossiper(Boolean autoStartGossipTicks, RemoteRpcProviderConfig config){
+        this(config);
         this.autoStartGossipTicks = autoStartGossipTicks;
     }
 
         this.autoStartGossipTicks = autoStartGossipTicks;
     }
 
index 334d872c44845b42bd25662f9a143be4d54e0e4c..6f21929d78b9059668e21b02ea2106a03652188f 100644 (file)
@@ -5,6 +5,7 @@ module remote-rpc-connector {
 
     import config { prefix config; revision-date 2013-04-05; }
     import opendaylight-md-sal-dom {prefix dom;}
 
     import config { prefix config; revision-date 2013-04-05; }
     import opendaylight-md-sal-dom {prefix dom;}
+    import actor-system-provider-service {prefix actor-system;}
 
     description
         "This module contains the base YANG definitions for
 
     description
         "This module contains the base YANG definitions for
@@ -35,18 +36,21 @@ module remote-rpc-connector {
                 }
             }
 
                 }
             }
 
+            container actor-system-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity actor-system:actor-system-provider-service;
+                    }
+                }
+            }
+
             leaf enable-metric-capture {
                 default false;
                 type boolean;
                 description "Enable or disable metric capture.";
             }
 
             leaf enable-metric-capture {
                 default false;
                 type boolean;
                 description "Enable or disable metric capture.";
             }
 
-            leaf actor-system-name {
-                default odl-cluster-rpc;
-                type string;
-                description "Name by which actor system is identified. Its also used to find relevant configuration";
-            }
-
             leaf bounded-mailbox-capacity {
                 default 1000;
                 type uint16;
             leaf bounded-mailbox-capacity {
                 default 1000;
                 type uint16;
index 78a368fe8df5fe2b1838d8296f2ba68173032a42..1187365a85e15a754d426a666b582b3c604400d2 100644 (file)
@@ -51,7 +51,8 @@ public class RemoteRpcProviderTest {
 
   @Test
   public void testRemoteRpcProvider() throws Exception {
 
   @Test
   public void testRemoteRpcProvider() throws Exception {
-    final RemoteRpcProvider rpcProvider = new RemoteRpcProvider(system, mock(DOMRpcProviderService.class));
+    final RemoteRpcProvider rpcProvider = new RemoteRpcProvider(system, mock(DOMRpcProviderService.class),
+            new RemoteRpcProviderConfig(system.settings().config()));
     final Broker.ProviderSession session = mock(Broker.ProviderSession.class);
     final SchemaService schemaService = mock(SchemaService.class);
     when(schemaService.getGlobalContext()). thenReturn(mock(SchemaContext.class));
     final Broker.ProviderSession session = mock(Broker.ProviderSession.class);
     final SchemaService schemaService = mock(SchemaService.class);
     when(schemaService.getGlobalContext()). thenReturn(mock(SchemaContext.class));
index d83d5131707df87ee6724da9ce75923800bc4022..8700334b22f6ea4839727d03a2580a3d16a011e5 100644 (file)
@@ -15,6 +15,8 @@ import akka.actor.Props;
 import akka.japi.Pair;
 import akka.testkit.JavaTestKit;
 import com.google.common.util.concurrent.Uninterruptibles;
 import akka.japi.Pair;
 import akka.testkit.JavaTestKit;
 import com.google.common.util.concurrent.Uninterruptibles;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -29,6 +31,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
@@ -61,26 +64,37 @@ public class RpcRegistryTest {
 
     @BeforeClass
     public static void staticSetup() throws InterruptedException {
 
     @BeforeClass
     public static void staticSetup() throws InterruptedException {
-      RemoteRpcProviderConfig config1 = new RemoteRpcProviderConfig.Builder("memberA").build();
-      RemoteRpcProviderConfig config2 = new RemoteRpcProviderConfig.Builder("memberB").build();
-      RemoteRpcProviderConfig config3 = new RemoteRpcProviderConfig.Builder("memberC").build();
-      node1 = ActorSystem.create("opendaylight-rpc", config1.get());
-      node2 = ActorSystem.create("opendaylight-rpc", config2.get());
-      node3 = ActorSystem.create("opendaylight-rpc", config3.get());
+        AkkaConfigurationReader reader = new AkkaConfigurationReader() {
+            @Override
+            public Config read() {
+                return ConfigFactory.load();
+            }
+        };
+
+        RemoteRpcProviderConfig config1 = new RemoteRpcProviderConfig.Builder("memberA").withConfigReader(reader).build();
+        RemoteRpcProviderConfig config2 = new RemoteRpcProviderConfig.Builder("memberB").withConfigReader(reader).build();
+        RemoteRpcProviderConfig config3 = new RemoteRpcProviderConfig.Builder("memberC").withConfigReader(reader).build();
+        node1 = ActorSystem.create("opendaylight-rpc", config1.get());
+        node2 = ActorSystem.create("opendaylight-rpc", config2.get());
+        node3 = ActorSystem.create("opendaylight-rpc", config3.get());
     }
 
     @AfterClass
     public static void staticTeardown() {
     }
 
     @AfterClass
     public static void staticTeardown() {
-      JavaTestKit.shutdownActorSystem(node1);
-      JavaTestKit.shutdownActorSystem(node2);
-      JavaTestKit.shutdownActorSystem(node3);
+        JavaTestKit.shutdownActorSystem(node1);
+        JavaTestKit.shutdownActorSystem(node2);
+        JavaTestKit.shutdownActorSystem(node3);
     }
 
     @Before
     public void setup() {
     }
 
     @Before
     public void setup() {
-        registry1 = node1.actorOf(Props.create(RpcRegistry.class));
-        registry2 = node2.actorOf(Props.create(RpcRegistry.class));
-        registry3 = node3.actorOf(Props.create(RpcRegistry.class));
+        registry1 = node1.actorOf(Props.create(RpcRegistry.class, config(node1)));
+        registry2 = node2.actorOf(Props.create(RpcRegistry.class, config(node2)));
+        registry3 = node3.actorOf(Props.create(RpcRegistry.class, config(node3)));
+    }
+
+    private RemoteRpcProviderConfig config(ActorSystem node){
+        return new RemoteRpcProviderConfig(node.settings().config());
     }
 
     @After
     }
 
     @After
index ddd08a5f4723f4c6669082c2fe4fcef3c6ff94af..667a1156f2688cf49fec2c8b53ffb31a53f7304f 100644 (file)
@@ -18,6 +18,7 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.TerminationMonitor;
 
 public class BucketStoreTest {
 import org.opendaylight.controller.remote.rpc.TerminationMonitor;
 
 public class BucketStoreTest {
@@ -131,7 +132,7 @@ public class BucketStoreTest {
      * @return instance of BucketStore class
      */
     private static BucketStore createStore(){
      * @return instance of BucketStore class
      */
     private static BucketStore createStore(){
-        final Props props = Props.create(BucketStore.class);
+        final Props props = Props.create(BucketStore.class, new RemoteRpcProviderConfig(system.settings().config()));
         final TestActorRef<BucketStore> testRef = TestActorRef.create(system, props, "testStore");
         return testRef.underlyingActor();
     }
         final TestActorRef<BucketStore> testRef = TestActorRef.create(system, props, "testStore");
         return testRef.underlyingActor();
     }
index cf42ebf1ccd4de520c4d5f4036f9a3e67cd75275..54b09bfce74bf2fb2880807faa2628d2db486924 100644 (file)
@@ -7,34 +7,33 @@
  */
 package org.opendaylight.controller.remote.rpc.registry.gossip;
 
  */
 package org.opendaylight.controller.remote.rpc.registry.gossip;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyMap;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipEnvelope;
+import static org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipStatus;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.Props;
 import akka.testkit.TestActorRef;
 import com.typesafe.config.ConfigFactory;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.Props;
 import akka.testkit.TestActorRef;
 import com.typesafe.config.ConfigFactory;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.TerminationMonitor;
 
 import org.opendaylight.controller.remote.rpc.TerminationMonitor;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyMap;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipEnvelope;
-import static org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipStatus;
-
 
 public class GossiperTest {
 
 
 public class GossiperTest {
 
@@ -121,7 +120,7 @@ public class GossiperTest {
      */
     private static Gossiper createGossiper(){
 
      */
     private static Gossiper createGossiper(){
 
-        final Props props = Props.create(Gossiper.class, false);
+        final Props props = Props.create(Gossiper.class, false, new RemoteRpcProviderConfig(system.settings().config()));
         final TestActorRef<Gossiper> testRef = TestActorRef.create(system, props, "testGossiper");
 
         return testRef.underlyingActor();
         final TestActorRef<Gossiper> testRef = TestActorRef.create(system, props, "testGossiper");
 
         return testRef.underlyingActor();