JEP 264: Platform Logging API and Service
Alan.Bateman at oracle.com
Wed Sep 30 14:14:10 UTC 2015
On 30/09/2015 14:59, Ralph Goers wrote:
> If I understand you correctly, then no that isn’t what I would want. The version and priority are captured in the same properties file where the class name is specified. If the class implements the wrong version or isn’t chosen due to its priority then the class isn’t loaded. To do what you are describing would require that serviceLoader load each class and that methods be called on each class to get that information. While that makes life simpler for the serviceLoader it makes it more complicated for the services being loaded.
It should be possible to create a service type that allows you to select
the appropriate service provider implementation. The service type can
also work as a factory so that once you select the service provider then
you invoke some method on it to get the actual logging provider.
More information about the core-libs-dev