Page 1 of 1

About Question enthuware.ocpjp.v8.2.1505 :

Posted: Sun Jan 31, 2016 7:48 am
by rocoty
"In which of the following cases a thread will definitely be alive but not be running?"
"The thread has issued a call to wait( )."

This statement is not necessarily true. A thread would have to own the intristic lock of the object for the thread to be definitely not running after a call to wait() has been issued.

If a call to wait() is issued and the calling thread does not own the lock on the object, an exception is thrown.

Re: About Question enthuware.ocpjp.v8.2.1505 :

Posted: Sun Jan 31, 2016 9:14 am
by admin
Sure. The option has been updated to make it clear.
thank you for your feedback!
Paul.

Re: About Question enthuware.ocpjp.v8.2.1505 :

Posted: Sun Jan 31, 2016 12:08 pm
by rocoty
I also noticed this, just now:

"The thread is trying to enter a synchronized block and the monitor is not free."
The explanation of which is:
"In this situation, the thread will be blocked until some other thread calls notify()/notifyAll() on the object whose synchronized block this thread is trying to enter."

I find this explanation wrong and that a more correct one would be:
"In this situation, the thread will be blocked until the monitor is set free and the thread takes the monitor. If, however, more threads are also waiting for the same monitor, either one of them can take it - but not both at the same time - in which case the other thread will block until the monitor is free again."

Something along those lines, no?

Re: About Question enthuware.ocpjp.v8.2.1505 :

Posted: Sun Jan 31, 2016 10:45 pm
by admin
Updated.
-Paul.