[jdk17] RFR: 8269543: The warning for System::setSecurityManager should only appear once for each caller
Roger Riggs
rriggs at openjdk.java.net
Tue Jun 29 19:59:59 UTC 2021
On Tue, 29 Jun 2021 19:35:40 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> Using a HashSet<Class> could use the callerClass as the key and be a stable reference for having given the message.
>> or use a ConcurrentHashMap<Class<?>>, boolean> and avoid any separate synchronization that would be needed with a HashSet or HashMap.
>
> If I switch to a "non-weak" set or map, then it seems I can safely use the source string as the key. Will using the Class object as a key prevent them from unloading?
Using a synchronized WeakHashMap with the class as the key would not prevent class unloading.
Using a non-weak set or map to strings would keep the strings around for the life of the runtime.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/166
More information about the security-dev
mailing list