Services and Bindings - expected usage scenarios

Pisarev, Vitaliy vitaliy.pisarev at hpe.com
Tue Nov 29 11:35:54 UTC 2016


Another best practices question.

I am aware that the ServiceLoader API is not new to Java. What's new in Java 9 is that is has been put forward to the front of the stage and it is now very easy
for a service provider to register a service.

The thing is that up until now, the ServiceLoader was a relatively low level component, primarily used by infrastructure components that loaded plugins that implemented various java specs.
It is no surprise than that the ServiceLoader is something that very few ever heard of.

Is it the intent of project Jigsaw that the service loader becomes a central and ubiquitous mechanism in the day to day work of plain old java developers?
As far as I am concerned, it is a very useful tool even when I do not have a plugin architecture and just want a module to expose a certain service via an interface without having to jump throw hooks
in order to provide the consumer a way to instantiate it..

Which leads me to the next question: is the returned instance a singleton or a prototype?


More information about the jigsaw-dev mailing list