Simple fix, you seem to have missed putting your “notify” and “wait” in a synchronized (the relevant object) block. Now, you may ask what is the relevant object. If the wait is waiting to get information that will help this object (with is a thread) run, then you should synchronize on “this”. If you are waiting for a linked list to get some information, then you should synchronize on that linked list object.
Do it right!!