Community

On demand resolution

reply from Thomas Diesler in JBoss Microcontainer Development - View the full discussion

This change causes regression in bundle lifecycle handling. I added test coverage for this in the framework's BundleLifecycleTestCase

 

The issue is that a bundle may automatically progress to state RESOLVED after it gets installed . The expected behaviour is that a bundle stays in state INSTALLED until the first class load triggers a state change to RESOLVED. It is important that bundles do not get resolved one-by-one as they get installed because this may lead to undesired wirings. i.e. the resolver might no be able to correctly wire a set of bundles together

 

Consider, bundle B imports a package from bundle X. B gets installed. Starting B fails because of the the unresolved constraint. Later X gets installed and is expected to be in state INSTALLED. Currently, X progesses unexpectedly to state RESOLVED.

 

      Bundle bundleB = installBundle(assembleArchive("lifecycle-bundleB", "/bundles/lifecycle/bundleB", ActivatorB.class, ServiceB.class));
      assertBundleState(Bundle.INSTALLED, bundleB.getState());
 
      try
      {
         bundleB.start();
         fail("Unresolved constraint expected");
      }
      catch (BundleException ex)
      {
         // expected
      }
 
      Bundle bundleX = installBundle(assembleArchive("lifecycle-bundleX", "/bundles/lifecycle/bundleX", X.class));
      System.out.println("FIXME [JBDEPLOY-245] Unexpected dependee state changes");
      //assertBundleState(Bundle.INSTALLED, bundleX.getState());
 

http://fisheye.jboss.org/browse/JBossOSGi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java?r=103300

 

I still need to look into the details of why this would happen.

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community