Add thread lock/unlock handling to persistence container