Folks,

we are still having disconnects between the OSGi Bundle lifecycle operations and their respective mapping to the deployment API. Here I'd like to describe how it currently works and how it could possibly get fixed. Related issues are tracked by [1] - further background is described in [2].

Bundle start/stop disconnect
--------------------------------------

A Bundle start/stop operation activates/deactivates the bundle services. The associated class loader and wiring is unaffected.

Approach #1 - start/stop is not mapped to deployment operations


Approach #2 -  start/stop is mapped to deployment operations


Currently, we use approach #2 with limited support from POST_MODULE DUPs (i.e. they are not designed to be executed multiple times for the same deployment). There is also the cleanup phase which breaks multiple executions of POST_MODULE DUPs.

Bundle uninstall disconnect
--------------------------------------

Bundle uninstall only removes the BundleRevision from the runtime if it is no longer in use. The classloader associated with an uninstalled bundle that is still in use remains active.

Approach #1 -  "in use" semantic specific to Bundle deployments


Approach #2 -  "in use" semantic applies to all deployment types


Bundle update disconnect
------------------------------------

A Bundle can have multiple revisions. A call to Bundle.update(…) creates a new revision. There is only ever one current revision (the latest update) associated with a Bundle. Stale revisions continue to exist in the runtime until an explicit refresh of the transitive dependency graph. 

Approach #1 - bundle revisions are represented as individual deployments

  • Each bundle update deploys the revision as a new deployment
  • The association of revisions to bundle happens in the OSGi layer only
  • Management sees disconnected deployments with no notion of stale/current or belonging together

Approach #2 - deployment API supports the notion of multiple revisions

  • deployments, their revisions and respective mapping would be modelled more closely on OSGi requirements
  • some deployment types might not support revisions 

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

I suspect that solving these disconnects can happen in the context of AS9 only.

Looking forward to your feedback

Cheers
--thomas

[1] [AS7-5567] Resolve AS8/OSGi disconnects 
[2] AS/OSGi Deployment Lifecycle Requirements
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx