0 Replies Latest reply on Jan 21, 2010 8:21 AM by adrian.brock

    ShutdownPolicy

      https://jira.jboss.org/jira/browse/JBCL-139

       

      To support the OSGi semantics of not automatically re-resolving classloader dependencies

      when you remove a classloader/deployment, I'm introducing a notion of ShutdownPolicy.

      This currently has two options:

       

      UNREGISTER - which is the current behaviour

      GARBAGE_COLLECTION - let the classloader remain valid after it is unregistered

       

      This can be set in two places.

       

      1) ClassLoaderSystem/Domain - it then applies to all classloaders in that domain that don't explicitly specify it

       

      2) ClassLoadingMetaData/Policy - in the xml it looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <classloader xmlns="urn:jboss:classloader:1.0"
                    name="test"
                    shutdown="GARBAGE_COLLECTION">
      </classloader>
      

       

      This effectively resolves https://jira.jboss.org/jira/browse/JBOSGI-206, except there's some work to do to implement the

      "refreshPackages" behaviour in ClassLoading.

       

      It also means that a Bundle update() can now be implemented as just a redeploy of the deployment (obviously there's a bit of extra

      work required in the OSGiBundleManager to remember and restore the deployment to its previous state, e.g. the start/stop options).

       

      NOTE: In the code I refer to the GC shutdown policy as "lazy shutdown", but also "cascading dependencies".

      The second part comes from not unresolving dependent classloaders if we are in "lazy shutdown" mode. Since the classloader

      is still valid, previous importers can still use it.