users@jsonb-spec.java.net

[jsonb-spec users] Re: JsonbProvider

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Mon, 14 Sep 2015 13:54:52 +0200

Hi,
   thanks for the feedback.

On 26/08/15 22:01, willem.salembier_at_gmail.com wrote:
> Some questions about JsonbProvider:
>
> - Is the eclipse default implementation already publicly available to
> actually run the examples?
We're just starting out the implementation at EclipseLink project at
this point, it usually wastes too much resources to start before EDR. I
will notify the list once there is something meaningful and perhaps
update the examples package as well.

> - Why does JsonbProvider#provider() have a Class.forName fallback
> option to load a hardcoded DEFAULT_PROVIDER instance? Is the
> ServiceLoader not sufficient? Does to spec need to have a runtime
> dependency on eclipse?
The main reason for the fallback is 'potential' Java SE integration,
where SE requires usually an explicit implementation to be loaded. There
may be other environments with similar requirements for a hardcoded
fallback. This does not mandate any eclipse runtime dependency though.

> - Instead, why does
> javax.json.bind.spi.JsonbProvider#provider(java.lang.String) with
> provider class name doesn't simply use Class.forName instead of using
> the ServiceLoader class?
The main purpose of the method is to allow to override the service
loader order which is needed in some usecases (seen with jax specs e.g.
in container usecases with multiple implementations available). There is
also a subtle difference in defaults classloaders used, and
ServiceLoader should cover Jigsaw as well.

  MartiNG