| Summary: | Implement bundle FindHook/EventHook support | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Thomas Watson <tjwatson> | ||||||
| Component: | Framework | Assignee: | Thomas Watson <tjwatson> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | hargrave | ||||||
| Version: | 3.6 | ||||||||
| Target Milestone: | 3.7 M2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Thomas Watson
Created attachment 176493 [details]
patch
BJ, please review.
I created a new public method org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ParameterizedRunnable<H>, String, String) to share the code that looks up hook registrations and calls out to them and handling exceptions etc. This is done by passing a ParameterizedRunnable which is used to make the actual hook call. This requires inner classes in order to maintain a state for the variables that get passed to the hook methods (poor man's closures). I worry that this may impact performance since it will create an extra object for each action event/find/listen. I am hoping one extra object creation is just noise when compared to all the other objects we are creating during these actions.
Also, I can see a way to call out to bundle EventHooks once for each event (instead once for sync and once for async listeners). We would need to have a shrinkable collection that wraps the two shrinkable collections representing the collection of async and sync listeners. Providing a iterator for such a collection that prevents duplicates would be needed. Created attachment 176617 [details]
Updated patch with composite ShrinkableCollection support
Tom, I reviewed the patch and made a number of changes. I replaced the use of ParameterizedRunnable since its use here was not cohesive. I created a HookContext interface to use as the "closure" for calling hooks.
I also updated the ShrinkableCollection type to wrap multiple collections and used that for bundle.EventHook to enable a single call to the hook for both sync and async bundle event listeners.
There are a number of other minor improvements and some improved comments.
I think this is ready for release. Let me know if you want me to release it to HEAD.
Released patch to HEAD. |