The thread T is then removed from the wait set for this object and re-enabled for thread scheduling. It then competes in the usual manner with other threads for the right to synchronize on the object; once it has gained control of the object, all its synchronization claims on the object are restored to the status quo ante - that is, to the situation as of the time that the wait method was invoked. Thread T then returns from the invocation of the wait method. Thus, on return from the wait method, the synchronization state of the object and of thread T is exactly as it was when the wait method was invoked.
Is there any possibilty that the synchonization state of the object is not "synchronized" before the call to wait? The API doesn't explicity say that the monitor was adquired before calling wait. Any particular reason?
SCJP2. Please Indent your code using UBB Code
Peter den Haan
posted 14 years ago
No, that's not possible. Object.wait() throws an IllegalMonitorStateException if you don't have a monitor lock on the object. See the Javadoc. - Peter