users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: Re: [1-RuntimeAPI] Proposal

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Mon, 02 Feb 2015 17:50:33 +0100

On 02.02.15 8:37, Przemyslaw Bielicki wrote:
> Last comment on ServiceLoader. I'm not a big fan of it and it seems
> I'm not alone:
> http://stackoverflow.com/questions/7039467/java-serviceloader-with-multiple-classloaders.
> I already had many issues with it in production using JAX-WS. I had to
> extend a bit CXF provider with custom behavior, which was the easiest
> part. The problem appeared when I wanted my provider to be picked up
> by app server. If you have in you classpath more than one service
> provider it's the classloader who decides which one will be used - not
> you. And it might differ from one OS to another (e.g. because of case
> sensitive JAR paths). It was a big pain and when you use ServiceLoader
> you cannot really explicitly say which provider you want to use -
> which is a showstopper for me.
In the proposal there's a call for provider(String providerName) with an
explicit provider string. Would that solve the problem?
  MartiNG