I was going through some code snippets looking at the synchronization aspect. I believe locking happens on objects. In the case of java we only have references to objects. Java should use the reference to procure the object and lock it.
What happens if the reference happens to be null? I feel this would break. If this were to work the locking needs to happen on references as well (which beats me). Can someone clarify this for me.
synchronized (formatters) {
if(formatters == null) {
prepareCache(feedId);
}
}