Skip to content

Support dynamic classloader-hook registration by framework extensions - #1367

Merged
HannesWell merged 1 commit into
eclipse-equinox:masterfrom
HannesWell:dynamic-classloader-hooks
Oct 8, 2026
Merged

HannesWell merged 1 commit into
eclipse-equinox:masterfrom
HannesWell:dynamic-classloader-hooks

Conversation

@HannesWell

@HannesWell HannesWell commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

As discussed in

being able to register classloader-hooks dynamically in the extension activator avoids the need to add the extension to the boot-classpath via the osgi.framework.extensions system-property.

Immediately use it in equinox.spi.

@HannesWell
HannesWell requested a review from tjwatson October 6, 2026 22:45
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Test Results

  234 files  ±0    234 suites  ±0   49m 45s ⏱️ - 1m 31s
2 231 tests ±0  2 182 ✅ ±0   49 💤 ±0  0 ❌ ±0 
6 456 runs  ±0  6 343 ✅ ±0  113 💤 ±0  0 ❌ ±0 

Results for commit 78c5916. ± Comparison against base commit 8294c6b.

♻️ This comment has been updated with latest results.

@HannesWell
HannesWell force-pushed the dynamic-classloader-hooks branch from 0c66d96 to ea66118 Compare October 6, 2026 23:36

@tjwatson tjwatson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a change to use ActivatorHookFactory to manage the tracker instance instead.

@tjwatson

tjwatson commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

One subtle thing I changed in my commit is to not restrict the registrations to only when the framework is STARTING. I believe you will want that for the spi implementation when it is installed and resolved by p2. When a framework extension is resolved after framework start then it will dynamically call the extensions bundle activator.

@HannesWell
HannesWell force-pushed the dynamic-classloader-hooks branch 3 times, most recently from 9282a83 to 6b8b425 Compare October 7, 2026 17:13
@HannesWell

HannesWell commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Thank you Tom for the update. The ActivatorHookFactory was the piece I missed and that makes it smoother.

One subtle thing I changed in my commit is to not restrict the registrations to only when the framework is STARTING. I believe you will want that for the spi implementation when it is installed and resolved by p2. When a framework extension is resolved after framework start then it will dynamically call the extensions bundle activator.

OK, that's fine for me as well. I assumed that P2 would require a framework restart anyway. But at the same time I'm not sure there are no cases where it's not happening later.

I squashed your commit into the first one and made a few more adjustments, mainly in the ServiceLoaderMediatorHookConfigurator and ServiceLoaderMediatorHook to initialize it more directly.

With that, this is ready from my POV.

@HannesWell
HannesWell force-pushed the dynamic-classloader-hooks branch from 00f5de4 to f727a4c Compare October 8, 2026 17:26
@HannesWell
HannesWell requested a review from tjwatson October 8, 2026 17:31

@tjwatson tjwatson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Being able to register classloader-hooks dynamically in the extension
activator avoids the need to add the extension to the boot-classpath via
the 'osgi.framework.extensions' system property.

Immediately use it in equinox.spi.

Co-authored-by: Thomas Watson <tjwatson@us.ibm.com>
@HannesWell
HannesWell force-pushed the dynamic-classloader-hooks branch from f727a4c to 78c5916 Compare October 8, 2026 20:55
@HannesWell

Copy link
Copy Markdown
Member Author

Just noticed that the hookconfigurators.properties file is now obsolete as well and removed it.

Thanks again for your review and help.

@HannesWell
HannesWell merged commit fae2800 into eclipse-equinox:master Oct 8, 2026
28 of 29 checks passed
@HannesWell
HannesWell deleted the dynamic-classloader-hooks branch October 8, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants