Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326707 - [RFC 159] Support in core for WeavingHook
Summary: [RFC 159] Support in core for WeavingHook
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 289124
  Show dependency tree
 
Reported: 2010-09-30 15:07 EDT by Thomas Watson CLA
Modified: 2011-01-10 13:09 EST (History)
2 users (show)

See Also:


Attachments
work in progess (19.12 KB, patch)
2010-09-30 15:15 EDT, Thomas Watson CLA
no flags Details | Diff
updated patch (54.67 KB, patch)
2010-10-11 14:29 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2010-09-30 15:07:52 EDT
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.
Comment 1 Thomas Watson CLA 2010-09-30 15:15:48 EDT
Created attachment 179991 [details]
work in progess

Untested work in progress.
Comment 2 Thomas Watson CLA 2010-09-30 15:20:19 EDT
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.
Comment 3 Martin Lippert CLA 2010-09-30 15:23:11 EDT
(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?
Comment 4 Thomas Watson CLA 2010-09-30 15:30:22 EDT
(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.
Comment 5 Thomas Watson CLA 2010-10-11 14:29:10 EDT
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.
Comment 6 Thomas Watson CLA 2010-10-13 11:56:13 EDT
I released the last patch with minor changes, to add copyrights and more comments.