replaced synchronize on Reentrant lock