If I access an object inside of a synchronized method or synchronized block, are all object in that accessed element also synchronized?
Imagine there's an object Queue having a synchronized add() and take() method, accepting and handing out the complex object Thing. Thing has a lot of lists with other different objects in it.
Now image thread Before creates Thing and puts some existing objects into Thing, modifies some of these object and so on. The Before thread adds Thing to Queue. A bit later thread After takes the Thing from Queue.
QUESTION: Will Thing and all its children/subobject be in the same state as Before left them in? Even if thread After was maybe working on one of these subelements a bit earlier? Because I image the processor for thread After might still have some cached information on that subelement (the address of that subobject is still the same). All this cached stuff would be invalidated only through accessing the father object Thing in a synchronized way?
Please don't give answers like use the concurrency libs etc. I want to understand what is going on.