Factoring out LockException