Replaced sun.misc lock with lock implementation refactored from Emerge Weave