On Thu, 9 Jun 2022 07:35:43 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:
> https://github.com/openjdk/jdk/blob/bc28baeba9360991e9b7575e1fbe178d873ccfc1/src/java.base/share/classes/jdk/internal/misc/Signal.java#L177-L178 > > Instead of separate Hashtable.get/remove calls we can just use value returned > by `remove`, > It results in cleaner and a bit faster code. src/java.base/share/classes/jdk/internal/misc/Signal.java line 180: > 178: if (newH == 2) { > 179: handlers.put(sig, handler); > 180: } If you made this change instead: Suggestion: Signal.Handler oldHandler; if (newH == 2) { oldHandler = handlers.replace(sig, handler); } else { oldHandler = handlers.remove(sig); } Wouldn't you be able to remove the entire `synchronized` block? ------------- PR: https://git.openjdk.org/jdk/pull/9100