The locking system in JDK 8u/7u in this area is fragile. See JDK-8268128 for more details. One possibility is to investigate if a similar design to JDK 17 can be used