A thread-safe Recursive Lock implemented in java for use in an old OS project