Hey.
You are not precise. You hold the lock on the "connections" object not "connection".
Please, take look at the explanation of "wait" method:
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()
Especially:
...
The current
thread must own this object's monitor. The thread
releases ownership of this monitor and waits until either of the following two conditions has occurred:
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 timeout period, specified by timeout milliseconds plus nanos nanoseconds arguments, has elapsed.
Adam
SCJP, SCWCD, SCBCD, SCDJWS