added ability to specify lock type and waiting time for LockCheck