X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2FActorSystemFactory.java;fp=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2FActorSystemFactory.java;h=0000000000000000000000000000000000000000;hb=25b805c6685467f561506dbb5187a744fc12096b;hp=6a442c57cc5dfac799760c74d11dedff9668c833;hpb=7875ce3584650306882d160707eb9ddef52f140b;p=controller.git diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java deleted file mode 100644 index 6a442c57cc..0000000000 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014 Cisco 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.remote.rpc; - -import akka.actor.ActorSystem; -import akka.osgi.BundleDelegatingClassLoader; -import org.opendaylight.controller.remote.rpc.utils.AkkaConfigurationReader; -import org.osgi.framework.BundleContext; - - -public class ActorSystemFactory { - - public static final String ACTOR_SYSTEM_NAME = "opendaylight-cluster-rpc"; - public static final String CONFIGURATION_NAME = "odl-cluster-rpc"; - - private static volatile ActorSystem actorSystem = null; - - public static final ActorSystem getInstance(){ - return actorSystem; - } - - /** - * This method should be called only once during initialization - * - * @param bundleContext - */ - public static final void createInstance(final BundleContext bundleContext, AkkaConfigurationReader akkaConfigurationReader) { - 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(ACTOR_SYSTEM_NAME, - akkaConfigurationReader.read().getConfig(CONFIGURATION_NAME), classLoader); - actorSystem = system; - } - } - } else { - throw new IllegalStateException("Actor system should be created only once. Use getInstance method to access existing actor system"); - } - } - -}