RFR: 8332086: Remove the usage of ServiceLoader in j.u.r.RandomGeneratorFactory
Daniel Fuchs
dfuchs at openjdk.org
Tue May 14 11:22:04 UTC 2024
On Mon, 13 May 2024 17:12:33 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> Not sure if that's an issue - but if you wanted/needed to delay the loading of those random generator classes that will not be used until something actually wants to use them, you could consider using a `Supplier<Class<? extends RandomGenerator>>` or a `Supplier<RandomGenEntry>` for the `FACTORY_MAP` values?
>
> @dfuch You mean not loading the whole batch but only individual classes, as need arises?
yes - I do not know if loading all the classes in one batch could be an issue at startup (I'd expect Random to be loaded early) - but if it proves to be, then using a Supplier to load them on demand might do the trick. If creating Random or SecureRandom does not trigger this code - and if those classes are not loaded at startup - then maybe that's a non issue and you can just ignore my comment.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19212#discussion_r1599847940
More information about the core-libs-dev
mailing list