Community
Participate
Working Groups
For OSGi R4.3 OSGi is going to specify a standard WeavingHook service that can hook into the OSGi classloader and allow for weaving hook services to participate in class weaving. Martin, once the specification has been more formalized we should look at updating equinox weaving to be built on top of the standard WeavingHook services. This would potentially allow equinox weaving support to be framework agnostic.
Created attachment 179991 [details] work in progess Untested work in progress.
There are two issues with the current work in progess. 1) The RFC mandates that the WeavingHook#weave method is called while holding no locks. Currently we hold the class loader lock (or on Java 7 we hold a class name lock). To do this outside of a lock we would need to call findLoadedClass multiple times in order to ensure that there is an atomic findLoadedClass/defineClass call. 2) The current support for adding new dynamic packages is very simplistic. Additional checks are needed to see if a dynamic wire can be established and we need to support matching attributes on the new imports that are added to WovenClass.
(In reply to comment #0) +1 Great to see progress on a general weaving hook for OSGi in R4.3. Should definitely consider a reimplementation of Equinox Weaving based on this. The interesting question will be whether we can throw away the basic Equinox Weaving implementation and reimplement just the aspect weaving on top of the new hook. Also interesting: Does the new weaving hook consider caching of woven class files? Or is this done automatically somehow?
(In reply to comment #3) > Also interesting: Does the new weaving hook consider caching of woven class > files? Or is this done automatically somehow? No, I think that would have to be left as value add for a framework implementation. Hopefully we could do that as an extension in equinox. I forget how you did that in equinox weaving.
Created attachment 180613 [details] updated patch Here is a well tested patch which also has a snapshot of the current API being proposed by OSGi for the weaving hook.
I released the last patch with minor changes, to add copyrights and more comments.