Fix concurrency problem when resource is deployed on multiple threads