From 7fec0d41c1fdfdb0eef04c6df8fb4b5368a975a5 Mon Sep 17 00:00:00 2001 From: Hao Kuang Date: Fri, 18 Aug 2017 16:07:56 +0000 Subject: Fix ExecutionQueue cannot be cleaned Fix that LCM Requests in Execution Queue continue after Stop OAM request sent. Fix that Appc-Ansible bundle cannot be fully stopped because of NPE. Issue-Id: APPC-159 Change-Id: I8f0a3a79a5c572ad84e66f71b4ddb47118704302 Signed-off-by: Hao Kuang --- .../appc/adapter/ansible/AnsibleActivator.java | 40 +++++++++------------- 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'appc-adapters') diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/openecomp/appc/adapter/ansible/AnsibleActivator.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/openecomp/appc/adapter/ansible/AnsibleActivator.java index fa81ef7f9..865841db2 100644 --- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/openecomp/appc/adapter/ansible/AnsibleActivator.java +++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/openecomp/appc/adapter/ansible/AnsibleActivator.java @@ -38,9 +38,6 @@ import com.att.eelf.configuration.EELFManager; /** * This activator is used to initialize and terminate an instance of AnsibleAdapter class - * - * Author : Ashwin Sridharan - * Date : Oct 2016 */ public class AnsibleActivator implements BundleActivator { @@ -57,12 +54,12 @@ public class AnsibleActivator implements BundleActivator { /** * The logger to be used */ - private static final EELFLogger logger = EELFManager.getInstance().getLogger(AnsibleActivator.class); + private final EELFLogger logger = EELFManager.getInstance().getLogger(AnsibleActivator.class); /** * The configuration object used to configure this bundle */ - private Configuration configuration; + private final Configuration configuration = ConfigurationFactory.getConfiguration(); /** * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start @@ -70,26 +67,24 @@ public class AnsibleActivator implements BundleActivator { *

* This method must complete and return to its caller in a timely manner. *

- * - * @param context - * The execution context of the bundle being started. - * @throws java.lang.Exception - * If this method throws an exception, this bundle is marked as stopped and the Framework will remove - * this bundle's listeners, unregister all services registered by this bundle, and release all services - * used by this bundle. + * + * @param context The execution context of the bundle being started. + * @throws java.lang.Exception If this method throws an exception, this bundle is marked as stopped and the + * Framework will remove this bundle's listeners, unregister all services registered + * by this bundle, and release all services used by this bundle. * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ @Override public void start(BundleContext context) throws Exception { logger.info("Starting bundle " + getName()); - String appName = "APPC: "; + String appName = "APPC: "; logger.info(Msg.COMPONENT_INITIALIZING, appName, "Ansible Adapter"); - adapter = new AnsibleAdapterImpl(); - + adapter = new AnsibleAdapterImpl(); + if (registration == null) { logger.info(Msg.REGISTERING_SERVICE, appName, adapter.getAdapterName(), - AnsibleAdapter.class.getSimpleName()); + AnsibleAdapter.class.getSimpleName()); registration = context.registerService(AnsibleAdapter.class, adapter, null); } @@ -104,13 +99,11 @@ public class AnsibleActivator implements BundleActivator { *

* This method must complete and return to its caller in a timely manner. *

- * - * @param context - * The execution context of the bundle being stopped. - * @throws java.lang.Exception - * If this method throws an exception, the bundle is still marked as stopped, and the Framework will - * remove the bundle's listeners, unregister all services registered by the bundle, and release all - * services used by the bundle. * + * + * @param context The execution context of the bundle being stopped. + * @throws java.lang.Exception If this method throws an exception, the bundle is still marked as stopped, and the + * Framework will remove the bundle's listeners, unregister all services registered + * by the bundle, and release all services used by the bundle. * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ @Override @@ -130,5 +123,4 @@ public class AnsibleActivator implements BundleActivator { public String getName() { return "APPC Ansible Adapter"; } - } -- cgit 1.2.3-korg