RFR: 8320687: sun.jvmstat.monitor.MonitoredHost.getMonitoredHost() throws unexpected exceptions when invoked concurrently [v3]
Jaikiran Pai
jpai at openjdk.org
Fri Nov 24 11:50:07 UTC 2023
On Fri, 24 Nov 2023 11:40:40 GMT, Alan Bateman <alanb at openjdk.org> 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
More information about the serviceability-dev
mailing list