Java provide benefit of avoiding thread pooling using interthread communication. The wait(), notify(), notifyAll() of Object class. These method are implemented as final in Object. All three method can be called only from within a synchronized context.
- wait() tells calling thread to give up monitor and go to sleep until some other thread enters the same monitor and call notify.
- notify() wakes up a thread that called wait() on same object.
- notifyAll() wakes up all the thread that called wait() on same object.