Replaced wrong usage of Object.notify() with Object.notifyAll().