Skip to main content

Core Improvement / Bring SPI first-class citizen

2 replies [Last post]
bjb
Offline
Joined: 2003-06-12
Points: 0

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.
trinition
Offline
Joined: 2003-07-29
Points: 0

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.

brucechapman
Offline
Joined: 2004-03-18
Points: 0

Agreed.

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.