Thread Issue


Why was theacquire() method synchronized in last weeks Resource Allocation Example?

JavaSoft VM Specification ...

" ... The wait method then adds the current thread to the wait set for the object, disables the current thread for thread scheduling purposes, and performs N unlock operations to relinquish the lock. The thread T then lies dormant ....."

Symantec Docs ...

"The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution."