lock inside try-catch