The answer to 1 is yes but I think you have more problems than that.
I'd simplify this down to synchronisation that covered A & B for reads and writes, with a single object to signal between threads and then optimise it later if you have to, you seem to be struggling a bit. If your not 100% confident simple is always best.
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
You must synchronize on both lists before looking at their combined
size. Otherwise, one of the add() methods could loose an object while
MyTask thinks the lists are empty. To process the non-empty lists, you
can synchronize separately again if you wish.
Jim ... ...
BEE MBA PMP SCJP-6
Joined: Dec 16, 2008
Thanks for your suggestions.
Chris Hurst ,
Could you provide sample program or tutorial to use the single object to signal between the thread.
I will also try "Jim Hoglund" suggestion given in the previous posts.
subject: Clarification required on synchronized block