synchronized(x) - how does it work?
I have an object with 3 internal caches that need to be updated, and I want to synchronize it for thread-safety but not excessively. ie, if I am updating cache #1 I only want to lock it, not any of the others. Does the following code work?:public my Object
{
privatestatic List cache1;
privatestatic List cache2;
privatestatic List cache3;
updateCache(List cache)
{
synchronized(cache){
//...update code
}
}
}
Thanks in advance.

