On 19/04/2020 16:05, Uwe Schindler wrote:
Hi Alan,
from what I understood: He has some utility method in a shared class that wraps
ServiceLoader to discover services and do something with it (the usual way to
prevent code duplication). Problem is that ServiceLoade.load() is
caller-sensitive,
Hi Alan
Yes, you read that correctly. Do you mean that in ServiceProvider that is in
moduleA we
will do something like this:
if (!SerivceProvider.class.getModule().canUse(S)) {
SerivceProvider.class.getModule().addUses(S)
}
//here we some logic and return S service.
Best regards
>Воск
, Germany
https://lucene.apache.org/
> -Original Message-
> From: jigsaw-dev On Behalf Of Alan
> Bateman
> Sent: Sunday, April 19, 2020 4:23 PM
> To: Alex Sviridov ; jigsaw-dev d...@openjdk.java.net>
> Subject: Re: Cross module single ServiceProvider for JPMS services
>
On 19/04/2020 15:00, Alex Sviridov wrote:
Hi all,
Let's suppose we have modules (A, B, C..) and every module consumes and provides services.
To find these services I want to create one util class, for example
ServiceProvider that will be used
by all modules to get necessary services. There a
Hi all,
Let's suppose we have modules (A, B, C..) and every module consumes and
provides services.
To find these services I want to create one util class, for example
ServiceProvider that will be used
by all modules to get necessary services. There are two ideas:
* to have one point to contro
Hi,
The problem you see is that ServiceLoader.load() is caller-sensitive, so it has
to be called from the exact module that will use the service.
You can still have some utility method that works on an already instantiated
service loader:
1. The utility class/method just takes a ServiceLoader