lockedobjects_db: Move lock logic to a context-manager method
lockedobjects_db: Move lock logic to a context-manager method

Partial-Bug: #1740667
Change-Id: I4b1fd42e05785dc7ec3b06ba69c3655f60d43a19

openstack/dragonflow,openstack/dragonflow,openstack/dragonflow