Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354715 - Command clhas triggers resolution of bundles and uses class loading
Summary: Command clhas triggers resolution of bundles and uses class loading
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.5.0.RELEASE   Edit
Assignee: Hristo Iliev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-15 04:20 EDT by Hristo Iliev CLA
Modified: 2011-09-01 11:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hristo Iliev CLA 2011-08-15 04:20:03 EDT
Command clhas uses Bundle.loadClass() which triggers bundles resolution and for lazy bundles can cause state change.

Since this is done on all bundles the effect may be that all lazy bundles change their state.

A possible improvement may be:
1) use of findEntries (according to the JavaDoc: "This bundle's class loader is not used to search for entries.")
2) scan all class loader resources (pretty hard if not impossible to achieve)
Comment 1 Glyn Normington CLA 2011-08-23 06:56:44 EDT
I don't see triggering resolution as being a major drawback. Bundles deployed in Virgo and almost always already resolved. When lazy activation bundles are deployed, they are aggressively started, meaning they too are already resolved.

I think we could close this as WONTFIX if we cannot find an elegant solution.
Comment 2 Hristo Iliev CLA 2011-08-23 07:14:35 EDT
I'm currently testing findEntries approach. It also allows search for resources and wildcards.
Comment 3 Hristo Iliev CLA 2011-08-26 06:13:52 EDT
Commit cb559540d895853b0340b500fc13c35d92bb333a introduces support for resource lookup with findEntries and wildcards in the search pattern.
Comment 4 Hristo Iliev CLA 2011-09-01 10:24:39 EDT
Commit ac3858421a631fad3d64d4e8e9fae14eba95b7db provides logic for searching the whole bundle for entity starting from the root. 

We need this since "the pattern is only matched against the last element of the entry path" as stated in findEntries JavaDoc. This means that web bundle that packages a class in WEB-INF/classes will not be found by findEntries since the path is prepended with WEB-INF/classes. TO overcome this we search for the class everywhere in the bundle and then filter the result.
Comment 5 Hristo Iliev CLA 2011-09-01 11:16:58 EDT
Added user guide documentation with commit 1fe4736dc32f3583e8e024a3731bda1f72aae788