Return-Path: X-Original-To: apmail-karaf-commits-archive@minotaur.apache.org Delivered-To: apmail-karaf-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7839CCEF8 for ; Wed, 3 Jul 2013 08:11:37 +0000 (UTC) Received: (qmail 99885 invoked by uid 500); 3 Jul 2013 08:11:36 -0000 Delivered-To: apmail-karaf-commits-archive@karaf.apache.org Received: (qmail 99833 invoked by uid 500); 3 Jul 2013 08:11:33 -0000 Mailing-List: contact commits-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list commits@karaf.apache.org Received: (qmail 99825 invoked by uid 99); 3 Jul 2013 08:11:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 08:11:32 +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; Wed, 03 Jul 2013 08:11:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0C0A92388ABA; Wed, 3 Jul 2013 08:11:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1499247 - in /karaf/branches/karaf-2.x: assemblies/apache-karaf/src/main/filtered-resources/etc/ assemblies/apache-karaf/src/main/filtered-resources/minimal/ features/core/src/main/java/org/apache/karaf/features/internal/ features/core/src... Date: Wed, 03 Jul 2013 08:11:09 -0000 To: commits@karaf.apache.org From: jbonofre@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130703081110.0C0A92388ABA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jbonofre Date: Wed Jul 3 08:11:09 2013 New Revision: 1499247 URL: http://svn.apache.org/r1499247 Log: [KARAF-2372] Introduce bootFeaturesAsynchronous property in etc/org.apache.karaf.features.cfg file Modified: karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/etc/org.apache.karaf.features.cfg karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/minimal/org.apache.karaf.features.cfg karaf/branches/karaf-2.x/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java karaf/branches/karaf-2.x/features/core/src/main/resources/OSGI-INF/blueprint/gshell-features.xml Modified: karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/etc/org.apache.karaf.features.cfg URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/etc/org.apache.karaf.features.cfg?rev=1499247&r1=1499246&r2=1499247&view=diff ============================================================================== --- karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/etc/org.apache.karaf.features.cfg (original) +++ karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/etc/org.apache.karaf.features.cfg Wed Jul 3 08:11:09 2013 @@ -28,3 +28,8 @@ featuresRepositories=mvn:org.apache.kara # Comma separated list of features to install at startup # featuresBoot=config,ssh,management,kar + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false Modified: karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/minimal/org.apache.karaf.features.cfg URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/minimal/org.apache.karaf.features.cfg?rev=1499247&r1=1499246&r2=1499247&view=diff ============================================================================== --- karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/minimal/org.apache.karaf.features.cfg (original) +++ karaf/branches/karaf-2.x/assemblies/apache-karaf/src/main/filtered-resources/minimal/org.apache.karaf.features.cfg Wed Jul 3 08:11:09 2013 @@ -33,3 +33,8 @@ featuresRepositories=mvn:org.apache.kara # Comma separated list of features to install at startup # featuresBoot=management + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false Modified: karaf/branches/karaf-2.x/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.x/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java?rev=1499247&r1=1499246&r2=1499247&view=diff ============================================================================== --- karaf/branches/karaf-2.x/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java (original) +++ karaf/branches/karaf-2.x/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java Wed Jul 3 08:11:09 2013 @@ -110,6 +110,7 @@ public class FeaturesServiceImpl impleme private Map> features; private Map> installed = new HashMap>(); private String boot; + private boolean bootFeaturesAsynchronous; private boolean bootFeaturesInstalled; private List listeners = new CopyOnWriteArrayIdentityList(); private ThreadLocal repo = new ThreadLocal(); @@ -198,6 +199,10 @@ public class FeaturesServiceImpl impleme this.boot = boot; } + public void setBootFeaturesAsynchronous(boolean bootFeaturesAsynchronous) { + this.bootFeaturesAsynchronous = bootFeaturesAsynchronous; + } + /** * Validate repository. * @@ -1108,50 +1113,101 @@ public class FeaturesServiceImpl impleme } // Install boot features if (boot != null && !bootFeaturesInstalled) { - // splitting the features - String[] list = boot.split(","); - Set features = new LinkedHashSet(); - for (String f : list) { - f = f.trim(); - if (f.length() > 0) { - String featureVersion = null; - - // first we split the parts of the feature string to gain access to the version info - // if specified - String[] parts = f.split(";"); - String featureName = parts[0]; - for (String part : parts) { - // if the part starts with "version=" it contains the version info - if (part.startsWith(FeatureImpl.VERSION_PREFIX)) { - featureVersion = part.substring(FeatureImpl.VERSION_PREFIX.length()); + if (bootFeaturesAsynchronous) { + new Thread() { + public void run() { + // splitting the features + String[] list = boot.split(","); + Set features = new LinkedHashSet(); + for (String f : list) { + f = f.trim(); + if (f.length() > 0) { + String featureVersion = null; + + // first we split the parts of the feature string to gain access to the version info + // if specified + String[] parts = f.split(";"); + String featureName = parts[0]; + for (String part : parts) { + // if the part starts with "version=" it contains the version info + if (part.startsWith(FeatureImpl.VERSION_PREFIX)) { + featureVersion = part.substring(FeatureImpl.VERSION_PREFIX.length()); + } + } + + if (featureVersion == null) { + // no version specified - use default version + featureVersion = FeatureImpl.DEFAULT_VERSION; + } + + try { + // try to grab specific feature version + Feature feature = getFeature(featureName, featureVersion); + if (feature != null) { + features.add(feature); + } else { + LOGGER.error("Error installing boot feature " + f + ": feature not found"); + } + } catch (Exception e) { + LOGGER.error("Error installing boot feature " + f, e); + } + } } + try { + installFeatures(features, EnumSet.of(Option.NoCleanIfFailure, Option.ContinueBatchOnFailure)); + } catch (Exception e) { + LOGGER.error("Error installing boot features", e); + } + bootFeaturesInstalled = true; + saveState(); } + }.start(); + } else { + // splitting the features + String[] list = boot.split(","); + Set features = new LinkedHashSet(); + for (String f : list) { + f = f.trim(); + if (f.length() > 0) { + String featureVersion = null; + + // first we split the parts of the feature string to gain access to the version info + // if specified + String[] parts = f.split(";"); + String featureName = parts[0]; + for (String part : parts) { + // if the part starts with "version=" it contains the version info + if (part.startsWith(FeatureImpl.VERSION_PREFIX)) { + featureVersion = part.substring(FeatureImpl.VERSION_PREFIX.length()); + } + } - if (featureVersion == null) { - // no version specified - use default version - featureVersion = FeatureImpl.DEFAULT_VERSION; - } + if (featureVersion == null) { + // no version specified - use default version + featureVersion = FeatureImpl.DEFAULT_VERSION; + } - try { - // try to grab specific feature version - Feature feature = getFeature(featureName, featureVersion); - if (feature != null) { - features.add(feature); - } else { - LOGGER.error("Error installing boot feature " + f + ": feature not found"); + try { + // try to grab specific feature version + Feature feature = getFeature(featureName, featureVersion); + if (feature != null) { + features.add(feature); + } else { + LOGGER.error("Error installing boot feature " + f + ": feature not found"); + } + } catch (Exception e) { + LOGGER.error("Error installing boot feature " + f, e); } - } catch (Exception e) { - LOGGER.error("Error installing boot feature " + f, e); } } + try { + installFeatures(features, EnumSet.of(Option.NoCleanIfFailure, Option.ContinueBatchOnFailure)); + } catch (Exception e) { + LOGGER.error("Error installing boot features", e); + } + bootFeaturesInstalled = true; + saveState(); } - try { - installFeatures(features, EnumSet.of(Option.NoCleanIfFailure, Option.ContinueBatchOnFailure)); - } catch (Exception e) { - LOGGER.error("Error installing boot features", e); - } - bootFeaturesInstalled = true; - saveState(); } } @@ -1348,10 +1404,10 @@ public class FeaturesServiceImpl impleme } } -static Pattern fuzzyVersion = Pattern.compile("(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?", - Pattern.DOTALL); -static Pattern fuzzyModifier = Pattern.compile("(\\d+[.-])*(.*)", - Pattern.DOTALL); + static Pattern fuzzyVersion = Pattern.compile("(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?", + Pattern.DOTALL); + static Pattern fuzzyModifier = Pattern.compile("(\\d+[.-])*(.*)", + Pattern.DOTALL); /** * Clean up version parameters. Other builders use more fuzzy definitions of Modified: karaf/branches/karaf-2.x/features/core/src/main/resources/OSGI-INF/blueprint/gshell-features.xml URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.x/features/core/src/main/resources/OSGI-INF/blueprint/gshell-features.xml?rev=1499247&r1=1499246&r2=1499247&view=diff ============================================================================== --- karaf/branches/karaf-2.x/features/core/src/main/resources/OSGI-INF/blueprint/gshell-features.xml (original) +++ karaf/branches/karaf-2.x/features/core/src/main/resources/OSGI-INF/blueprint/gshell-features.xml Wed Jul 3 08:11:09 2013 @@ -28,6 +28,7 @@ + file:$(karaf.base)/etc/org.apache.karaf.features.cfg @@ -35,6 +36,7 @@ +