Don't create lock object if not needed.

#PLAT-718