Thanks Wangda Tan, Sunil G for reviews.
Lock is not required
Right. Will fix.
You may need to synchronize placesBlacklistedByApp and call placesBlacklistedByApp.addAll(appInfo.getBlackList()) to make it consistent to other blacklist-related operations.
But we wont be using this till we set current attempt in scheduler which is after this. Also, this is a reference assignment which is atomic. Thoughts ?
(Imaging someone replace the request in another thread before returning)
You mean remove the request from the resource request map ? Well the part about fetching from resource request map i.e. call to getResourceRequest is within locks. After that we just access ResourceRequest instance. And capability which we are returning here wont be changed even by another thread. However this is is not immutable field so we can probably guard it with a read lock just to be safe. Thoughts ?