You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Raymond Auge <ra...@liferay.com> on 2018/05/16 16:32:25 UTC

Eliminating osgi locator shade

Hello All,

Romain mentioned in another thread about wanting to eliminate the osgi
locator shade. I would be super happy to make this happen.

This can be accomplished by leveraging the Service Loader Mediator. However
there is a caveat. In order to stick with the Service Mediator spec, the
code in question must be using the method

java.util.ServiceLoader.load(Class<T>)

This is to ensure that proper weaving can be accomplished at runtime.

In testing, I applied the required metadata on geronimo-jsonb_1.0_spec and
this worked fine, however jsonb depends on jsonp (for instance
geronimo-jsonp_1.1_spec) which, when I use these to gether, I
found geronimo-jsonp_1.x_spec does not use ServiceLoader at all, but rather
a self implementation of such [1].

Would it be fair to replace the self implemented logic with the logic found
in the geronimo-jsonb [2] which does the same but using ServiceLoader?

Finally, if the goal is to enable Service Loader Mediator to replace all
osgi locator, then we need to ensure this pattern is followed throughout.
Does that seem fair? If so I can go through and apply the fix in many
places.

Sincerely,
- Ray

[1]
https://github.com/apache/geronimo-specs/blob/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/spi/JsonProvider.java#L105-L149
[2]
https://github.com/apache/geronimo-specs/blob/trunk/geronimo-jsonb_1.0_spec/src/main/java/javax/json/bind/spi/JsonbProvider.java#L64-L71


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Re: Eliminating osgi locator shade

Posted by Raymond Auge <ra...@liferay.com>.
Fine with me as well!

On Wed, May 16, 2018 at 4:31 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> We can scope it for >= java 6 specs if that's the only blocker we hit.
> This is perfectly fine IMHO.
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>
>
> Le mer. 16 mai 2018 à 22:28, David Jencks <da...@gmail.com> a
> écrit :
>
>> It’s been a really long time since I looked at any of this and I might
>> not remember accurately or understand the scope of what you propose to do
>> .... IIRC there were a few specs that predate ServiceLoader and use
>> something similar but incompatible that the locator takes care of. So, you
>> might have trouble removing the locator code everywhere.
>>
>> David Jencks
>>
>> Sent from my iPhone
>>
>> On May 16, 2018, at 9:32 AM, Raymond Auge <ra...@liferay.com>
>> wrote:
>>
>> Hello All,
>>
>> Romain mentioned in another thread about wanting to eliminate the osgi
>> locator shade. I would be super happy to make this happen.
>>
>> This can be accomplished by leveraging the Service Loader Mediator.
>> However there is a caveat. In order to stick with the Service Mediator
>> spec, the code in question must be using the method
>>
>> java.util.ServiceLoader.load(Class<T>)
>>
>> This is to ensure that proper weaving can be accomplished at runtime.
>>
>> In testing, I applied the required metadata on geronimo-jsonb_1.0_spec
>> and this worked fine, however jsonb depends on jsonp (for instance
>> geronimo-jsonp_1.1_spec) which, when I use these to gether, I
>> found geronimo-jsonp_1.x_spec does not use ServiceLoader at all, but rather
>> a self implementation of such [1].
>>
>> Would it be fair to replace the self implemented logic with the logic
>> found in the geronimo-jsonb [2] which does the same but using ServiceLoader?
>>
>> Finally, if the goal is to enable Service Loader Mediator to replace all
>> osgi locator, then we need to ensure this pattern is followed throughout.
>> Does that seem fair? If so I can go through and apply the fix in many
>> places.
>>
>> Sincerely,
>> - Ray
>>
>> [1] https://github.com/apache/geronimo-specs/blob/trunk/
>> geronimo-json_1.1_spec/src/main/java/javax/json/spi/
>> JsonProvider.java#L105-L149
>> [2] https://github.com/apache/geronimo-specs/blob/trunk/
>> geronimo-jsonb_1.0_spec/src/main/java/javax/json/bind/spi/
>> JsonbProvider.java#L64-L71
>>
>>
>> --
>> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>>  (@rotty3000)
>> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
>>  (@Liferay)
>> Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
>> (@OSGiAlliance)
>>
>>


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Re: Eliminating osgi locator shade

Posted by Romain Manni-Bucau <rm...@gmail.com>.
We can scope it for >= java 6 specs if that's the only blocker we hit. This
is perfectly fine IMHO.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mer. 16 mai 2018 à 22:28, David Jencks <da...@gmail.com> a
écrit :

> It’s been a really long time since I looked at any of this and I might not
> remember accurately or understand the scope of what you propose to do ....
> IIRC there were a few specs that predate ServiceLoader and use something
> similar but incompatible that the locator takes care of. So, you might have
> trouble removing the locator code everywhere.
>
> David Jencks
>
> Sent from my iPhone
>
> On May 16, 2018, at 9:32 AM, Raymond Auge <ra...@liferay.com>
> wrote:
>
> Hello All,
>
> Romain mentioned in another thread about wanting to eliminate the osgi
> locator shade. I would be super happy to make this happen.
>
> This can be accomplished by leveraging the Service Loader Mediator.
> However there is a caveat. In order to stick with the Service Mediator
> spec, the code in question must be using the method
>
> java.util.ServiceLoader.load(Class<T>)
>
> This is to ensure that proper weaving can be accomplished at runtime.
>
> In testing, I applied the required metadata on geronimo-jsonb_1.0_spec and
> this worked fine, however jsonb depends on jsonp (for instance
> geronimo-jsonp_1.1_spec) which, when I use these to gether, I
> found geronimo-jsonp_1.x_spec does not use ServiceLoader at all, but rather
> a self implementation of such [1].
>
> Would it be fair to replace the self implemented logic with the logic
> found in the geronimo-jsonb [2] which does the same but using ServiceLoader?
>
> Finally, if the goal is to enable Service Loader Mediator to replace all
> osgi locator, then we need to ensure this pattern is followed throughout.
> Does that seem fair? If so I can go through and apply the fix in many
> places.
>
> Sincerely,
> - Ray
>
> [1]
> https://github.com/apache/geronimo-specs/blob/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/spi/JsonProvider.java#L105-L149
> [2]
> https://github.com/apache/geronimo-specs/blob/trunk/geronimo-jsonb_1.0_spec/src/main/java/javax/json/bind/spi/JsonbProvider.java#L64-L71
>
>
> --
> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>  (@rotty3000)
> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
>  (@Liferay)
> Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
> (@OSGiAlliance)
>
>

Re: Eliminating osgi locator shade

Posted by David Jencks <da...@gmail.com>.
It’s been a really long time since I looked at any of this and I might not remember accurately or understand the scope of what you propose to do .... IIRC there were a few specs that predate ServiceLoader and use something similar but incompatible that the locator takes care of. So, you might have trouble removing the locator code everywhere.

David Jencks 

Sent from my iPhone

> On May 16, 2018, at 9:32 AM, Raymond Auge <ra...@liferay.com> wrote:
> 
> Hello All,
> 
> Romain mentioned in another thread about wanting to eliminate the osgi locator shade. I would be super happy to make this happen.
> 
> This can be accomplished by leveraging the Service Loader Mediator. However there is a caveat. In order to stick with the Service Mediator spec, the code in question must be using the method
> 
> java.util.ServiceLoader.load(Class<T>)
> 
> This is to ensure that proper weaving can be accomplished at runtime.
> 
> In testing, I applied the required metadata on geronimo-jsonb_1.0_spec and this worked fine, however jsonb depends on jsonp (for instance geronimo-jsonp_1.1_spec) which, when I use these to gether, I found geronimo-jsonp_1.x_spec does not use ServiceLoader at all, but rather a self implementation of such [1].
> 
> Would it be fair to replace the self implemented logic with the logic found in the geronimo-jsonb [2] which does the same but using ServiceLoader?
> 
> Finally, if the goal is to enable Service Loader Mediator to replace all osgi locator, then we need to ensure this pattern is followed throughout. Does that seem fair? If so I can go through and apply the fix in many places.
> 
> Sincerely,
> - Ray
> 
> [1] https://github.com/apache/geronimo-specs/blob/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/spi/JsonProvider.java#L105-L149
> [2] https://github.com/apache/geronimo-specs/blob/trunk/geronimo-jsonb_1.0_spec/src/main/java/javax/json/bind/spi/JsonbProvider.java#L64-L71
> 
> 
> -- 
> Raymond Augé (@rotty3000)
> Senior Software Architect Liferay, Inc. (@Liferay)
> Board Member & EEG Co-Chair, OSGi Alliance (@OSGiAlliance)