SCJP2. Please Indent your code using UBB Code
SCJP2. Please Indent your code using UBB Code
But I have one more doubt, in my first example, could there be chances that the Calculator thread was given the chance to run before any Reader thread(thus issuing a notify before any Reader waits for the lock), then there will be a chance that all three Reader threads will be waiting in the pool forever?
I think this could happen as least is guaranteed when it comes to threads !
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by David Willis:
Barry,
You have it mixed up. The start of the Calulator thread should be moved DOWN below the three new statements.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP2. Please Indent your code using UBB Code
SCJP2. Please Indent your code using UBB Code
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Giselle Dazzi<br />SCJP 1.4
Giselle Dazzi<br />SCJP 1.4