You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Christoph Gritschenberger <ch...@gmail.com> on 2013/01/18 16:29:58 UTC

Re: svn commit: r1435050 - /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java

I just tested blueprint-core with Guillaumes most recent commit on 
current karaf-trunk and during shutdown I now get two Exceptions (see 
attachement). It only occurs with felix (not with equinox).

The problem is that the BlueprintExtender's stop-method is called twice. 
Once by the BundleTracker picks up the system-bundle stopping, and once 
again when the Framework call's it because it stops the bundle.

This means that the BundleHookBundleTracker's close-method is called 
twice. Doing this (as opposed to a regular BundleTracker) always results 
in a IllegalStateException (I filed ARIES-1005 for that).

kind regards,
Christoph

> Author: gnodet
> Date: Fri Jan 18 08:31:42 2013
> New Revision: 1435050
>
> URL: http://svn.apache.org/viewvc?rev=1435050&view=rev
> Log:
> [ARIES-1004] When the framework is being shut down, blueprint bundles are not shut down orderly
>
> Modified:
>     aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
>
> Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
> URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java?rev=1435050&r1=1435049&r2=1435050&view=diff
> ==============================================================================
> --- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
> (original)
> +++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
> Fri Jan 18 08:31:42 2013
> @@ -190,6 +190,16 @@ public class BlueprintExtender implement
>      }
>
>      public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) {
> +        // If the bundle being stopped is the system bundle,
> +        // do an orderly shutdown of all blueprint contexts now
> +        // so that service usage can actually be useful
> +        if (bundle.getBundleId() == 0 && bundle.getState() == Bundle.STOPPING) {
> +            String val = context.getProperty("org.apache.aries.blueprint.preemptiveShutdown");
> +            if (val == null || Boolean.parseBoolean(val)) {
> +                stop(context);
> +                return;
> +            }
> +        }
>          if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING)
> {
>              // The bundle is not in STARTING or ACTIVE state anymore
>              // so destroy the context