On Fri, 24 Nov 2023 11:40:40 GMT, Alan Bateman <[email protected]> wrote:
> > Right now, the sole usage of the `monitoredHostServiceLoader` instance is
> > within a `synchronized (monitoredHosts) {...}` block within a method. So it
> > wouldn't require this `assert`.
>
> Okay, I guess part of me wonders why this field is needed in the first place.
> Why can't getMonitoredHost just create a ServiceLoader instead instead of
> trying to share between threads?
It can and that works too. That was one of the alternatives I had initially
tried. I explain in this previous comment
https://github.com/openjdk/jdk/pull/16805#issuecomment-1825194163 the reason
why I thought sharing the ServiceLoader might be better. Do you think I should
just use the local ServiceLoader approach instead?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16805#discussion_r1404266670