+ if(actorSystem == null) {
+ // Create an OSGi bundle classloader for actor system
+ BundleDelegatingClassLoader classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle(),
+ Thread.currentThread().getContextClassLoader());
+ synchronized (ActorSystemFactory.class) {
+ // Double check
+ if (actorSystem == null) {
+ ActorSystem system = ActorSystem.create("opendaylight-rpc",
+ ConfigFactory.load().getConfig("odl-cluster"), classLoader);
+ actorSystem = system;
+ }
+ }
+ } else {
+ throw new IllegalStateException("Actor system should be created only once. Use getInstance method to access existing actor system");