Return-Path: Delivered-To: apmail-aries-commits-archive@www.apache.org Received: (qmail 43730 invoked from network); 7 Feb 2011 15:15:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Feb 2011 15:15:27 -0000 Received: (qmail 15203 invoked by uid 500); 7 Feb 2011 15:15:27 -0000 Delivered-To: apmail-aries-commits-archive@aries.apache.org Received: (qmail 15118 invoked by uid 500); 7 Feb 2011 15:15:23 -0000 Mailing-List: contact commits-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list commits@aries.apache.org Received: (qmail 15106 invoked by uid 99); 7 Feb 2011 15:15:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 15:15:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 15:15:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B90B82388A2C; Mon, 7 Feb 2011 15:15:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1067961 - /aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java Date: Mon, 07 Feb 2011 15:15:01 -0000 To: commits@aries.apache.org From: cwilkin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110207151501.B90B82388A2C@eris.apache.org> Author: cwilkin Date: Mon Feb 7 15:15:01 2011 New Revision: 1067961 URL: http://svn.apache.org/viewvc?rev=1067961&view=rev Log: ARIES-559 : Separate out initialise and start of bundle framework Modified: aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java Modified: aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java URL: http://svn.apache.org/viewvc/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java?rev=1067961&r1=1067960&r2=1067961&view=diff ============================================================================== --- aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java (original) +++ aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java Mon Feb 7 15:15:01 2011 @@ -159,31 +159,21 @@ public class BundleFrameworkManagerImpl // We should now have a bundleFramework if (bundleFramework != null) { - - boolean frameworkStarted = false; - try { - // Start the empty framework bundle - bundleFramework.start(); - frameworkStarted = true; - } catch (BundleException e) { - // This may fail if the framework bundle has exports but we will retry later - } - - /** - * Install the bundles into the new framework - */ - try { - List installedBundles = new ArrayList(); + try { + // Initialise the framework (this does not start anything) + bundleFramework.init(); + + /** + * Install the bundles into the new framework + */ + BundleContext frameworkBundleContext = bundleFramework.getIsolatedBundleContext(); if (frameworkBundleContext != null) { for (BundleSuggestion suggestion : bundlesToBeInstalled) - installedBundles.add(bundleFramework.install(suggestion, app)); - } + bundleFramework.install(suggestion, app); + } - // Finally, start the whole lot - if (!frameworkStarted) - bundleFramework.start(); } catch (BundleException be) { bundleFramework.close(); throw be; @@ -226,10 +216,16 @@ public class BundleFrameworkManagerImpl { synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) { BundleFramework framework = getBundleFramework(b); + + // Start all bundles inside the framework if (framework != null) // App Content { + // Start the framework in case not already started + framework.start(); + for (Bundle bundle : framework.getBundles()) framework.start(bundle); + } else // Shared bundle _sharedBundleFramework.start(b); } @@ -239,11 +235,17 @@ public class BundleFrameworkManagerImpl { synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) { BundleFramework framework = getBundleFramework(b); + + // Stop all bundles inside the framework if (framework != null) // App Content { for (Bundle bundle : framework.getBundles()) framework.stop(bundle); + + // Stop the framework + framework.getFrameworkBundle().stop(); } + // Do not stop shared bundles } }