Skip to main content

Core Improvement / Bring SPI first-class citizen

2 replies [Last post]
Joined: 2003-06-12

Finding out SPI implementations you have to deal with undocumented class sun.misc.Service !!!

This is not acceptable as lots of J2SE API rely on that mechanism :(

Every SPI enable API like Javasound came up with their own solution for doing things.

SPI-like things are also used in java web start services but in an inconsistent way regard the regular SPI mechanism ...

So let's have a first-class SPI related JSR that will define a firs-class citizenship for the SPI mechanism.

- What is SPI
- How you implement SPI
- How you bind a SPI
- How you lookup for an implementation
- How you lookup for an implementation that match "some given features"

There should be ways also for a "ServiceManager" to install and uninstall SPI implementations "at the fly".

Please consider this ...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-07-29

I agree 100%. I've implemented my own clone of SPI on several projects. However, when you bring it out, don't stop there. Add optional support for version constraints relying on java.lang.Package.getXXXVersion. THen I can finally package various implementations of an interface in separate jars and let SPI make sure it selects one with the right version at runtime.

Joined: 2004-03-18


The new (tiger) apt tool uses Services as well, even refers to it in documentation (as does the jar spec), but this mechanism (which is really nice, extensible, and sensible) isn't in the core API.