[jboss-user] [JBoss Microcontainer Development] - On demand resolution

Adrian Brock do-not-reply at jboss.com
Tue Mar 30 05:56:05 EDT 2010


Adrian Brock [http://community.jboss.org/people/adrian%40jboss.org] replied to the discussion

"On demand resolution"

To view the discussion, visit: http://community.jboss.org/message/534591#534591

--------------------------------------------------------------
> Ales Justin wrote:
> 
> > I created a test for DynamicImport-Package to check whether  https://jira.jboss.org/jira/browse/JBCL-131 https://jira.jboss.org/jira/browse/JBCL-131 is actually working at the OSGi layer.
> I fail to see how dynamic import and JBCL-131 are related?
> JBCL-131 is an impl of OSGi' lazy bundle activation -- e.g. only invoke BundleActivator if some class from that bundle needs to be loaded.
Well actually JBCL-131 is about lazy resolve, not lazy start.
It's not working because it hasn't been enabled.

I've committed the following patch which makes it work using Ales's DeploymentMetaData
(I've not done anything with lazy start).
I don't know if that is the correct place for it?
Another question is whether you always want to enable lazy resolve for OSGi, even if the user specifies something else?

P.S. There's no point re-opening issues in closed releases. You need to raise new issues.

/core/src/main/java/org/jboss/osgi/framework/deployers
$ svn diff
Index: AbstractClassLoadingDeployer.java
===================================================================
--- AbstractClassLoadingDeployer.java    (revision 103238)
+++ AbstractClassLoadingDeployer.java    (working copy)
@@ -29,6 +29,7 @@
 import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
 import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
 import org.jboss.classloading.spi.metadata.RequirementsMetaData;
+import org.jboss.deployers.plugins.classloading.DeploymentMetaData;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
@@ -61,7 +62,10 @@
    {
       super(OSGiMetaData.class);
       addInput(AbstractBundleState.class);
-      setOutput(ClassLoadingMetaData.class);
+      addInput(ClassLoadingMetaData.class);
+      addInput(DeploymentMetaData.class);
+      addOutput(ClassLoadingMetaData.class);
+      addOutput(DeploymentMetaData.class);
       setStage(DeploymentStages.POST_PARSE);
       setTopLevelOnly(true);
    }
@@ -79,6 +83,13 @@
    @Override
    public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
    {
+      if (unit.isAttachmentPresent(DeploymentMetaData.class) == false)
+      {
+         DeploymentMetaData deploymentMetaData = new DeploymentMetaData();
+         deploymentMetaData.setLazyResolve(true);
+         unit.addAttachment(DeploymentMetaData.class, deploymentMetaData);
+      }
+      
       if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
          return;

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/534591#534591]

Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100330/3fd0a9eb/attachment.html 


More information about the jboss-user mailing list