adding safelock from jdk example