glassfish
  1. glassfish
  2. GLASSFISH-19215 Add support CDI in plain OSGi bundles
  3. GLASSFISH-19344

adding the handling logic of Weld Container Shutting Down in OSGiCDIExtender class

    Details

    • Type: Sub-task Sub-task
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: future release
    • Fix Version/s: None
    • Component/s: OSGi-JavaEE
    • Labels:
      None

      Description

      Needing to adding the handling logic of Weld Container Shutting Down in OSGiCDIExtender class.

        Activity

        Hide
        TangYong added a comment -

        2 Adding WeldBootstrap.shutdown handling logic while executing stop-domain

        In OSGiCDIExtender.stop(), adding WeldBootstrap.shutdown handling logic as following,

        public synchronized void stop() {

        if (tracker != null) tracker.close();
        tracker = null;

        for(Long bundleId : managedBootstraps.keySet()){
        WeldBootstrap bootstrap = managedBootstraps.get(bundleId).getBootstrap();
        if (bootstrap != null){
        ClassLoader oldTCC = Thread.currentThread().getContextClassLoader();
        try

        { ClassLoader newTCC = managedBootstraps.get(bundleId).getClassLoader(); Thread.currentThread().setContextClassLoader(newTCC); bootstrap.shutdown(); }

        catch(RuntimeException e)

        { e.printStackTrace(); }

        finally

        { Thread.currentThread().setContextClassLoader(oldTCC); }


        }
        }

        managedBootstraps.clear();
        managedBootstraps = null;
        }

        Show
        TangYong added a comment - 2 Adding WeldBootstrap.shutdown handling logic while executing stop-domain In OSGiCDIExtender.stop(), adding WeldBootstrap.shutdown handling logic as following, public synchronized void stop() { if (tracker != null) tracker.close(); tracker = null; for(Long bundleId : managedBootstraps.keySet()){ WeldBootstrap bootstrap = managedBootstraps.get(bundleId).getBootstrap(); if (bootstrap != null){ ClassLoader oldTCC = Thread.currentThread().getContextClassLoader(); try { ClassLoader newTCC = managedBootstraps.get(bundleId).getClassLoader(); Thread.currentThread().setContextClassLoader(newTCC); bootstrap.shutdown(); } catch(RuntimeException e) { e.printStackTrace(); } finally { Thread.currentThread().setContextClassLoader(oldTCC); } } } managedBootstraps.clear(); managedBootstraps = null; }
        Hide
        TangYong added a comment -

        1 Adding WeldBootstrap.shutdown handling logic while using asadmin osgi stop "bundleID"

        1) make OSGiCDIExtender's BundleTracker add Bundle.STOPPING to track bundles in the state of STOPPING
        2) add handling logic in BeanBundleTrackerCustomizer's modifiedBundle method

        Show
        TangYong added a comment - 1 Adding WeldBootstrap.shutdown handling logic while using asadmin osgi stop "bundleID" 1) make OSGiCDIExtender's BundleTracker add Bundle.STOPPING to track bundles in the state of STOPPING 2) add handling logic in BeanBundleTrackerCustomizer's modifiedBundle method

          People

          • Assignee:
            Sanjeeb Sahoo
            Reporter:
            TangYong
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: