Merge pull request #12560 from sue445/modify_find_lock_sample_code

avoid deprecation warning in sample code [ci skip]