On Aug 13, 2014, at 23:31, mark.reinh...@oracle.com wrote:

> 2014/8/13 7:20 -0700, alan.bate...@oracle.com:
>> The usual thing is to just have a default implementation that is used 
>> when ServiceLoader doesn't locate a useful provider. You'll find many 
>> examples of this in the JDK. In those cases then the default is not 
>> listed in a services configuration file. From what you describe then 
>> this may be what you want too.
>> 
>> ServiceLoader does not have a way to configure a preferred provider so 
>> this is one reason why you'll see places where a system property can be 
>> used to configured the preferred implementation.
> 
> Another alternative is to use the ServiceLoader::loadInstalled method,
> which will ignore providers on the application class path.

Great, this works for me.

But why does it need to be called in a doPrivileged() block? Isn't it only 
about JDK-internal classes/resources?

Thanks
Max

> 
> - Mark

Reply via email to