Add support CDI in plain OSGi bundles (GLASSFISH-19215)

[GLASSFISH-19344] adding the handling logic of Weld Container Shutting Down in OSGiCDIExtender class Created: 14/Nov/12  Updated: 14/Nov/12

Status: Open
Project: glassfish
Component/s: OSGi-JavaEE
Affects Version/s: future release
Fix Version/s: None

Type: Sub-task Priority: Major
Reporter: TangYong Assignee: Sanjeeb Sahoo
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


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

Comment by TangYong [ 14/Nov/12 ]

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

Comment by TangYong [ 14/Nov/12 ]

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();

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

catch(RuntimeException e)

{ e.printStackTrace(); }


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


managedBootstraps = null;

Generated at Mon Oct 24 03:18:03 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.