I tried to teach myself concurrency, and I had a problem. I understand that two Java threads can communicate with each other via wait () and notify ().
Classical Java thread tutorials teach you to wait / notify early on. Back around Java 1.1, 1.2 is the time frame that everything was.
However, if you can get a copy of Brian Goetz’s excellent “Java Concurrency in Practice”, wait / notify is not discussed until chapter 14, “Creating Custom Synchronizers,” in section IV of the extended topics. I'm seriously rephrasing here, but the impression I got was “Well, if you read the 300 previous pages, and none of the building blocks discussed so far matches your needs, then you can try to create your own using wait / notify "
My point is that wait / notify, although very important, may not be the best place to start learning concurrency. Some of the answers / comments in this question (producer / consumer, ExecutorService) relate to the higher levels of Concurrency that were added in Java 5. Although this material was added later, this is the material you should study first.
Back to your question - here are a few thoughts:
If this is a GUI application and you want the background thread to do some work, check out SwingWorker . I had success using SwingWorker (section 9.3.3), where the background thread reads messages from the blocking queue (section 5.3), does some work, and notifies the GUI thread by invoking a higher-level publish method. No "wait / notify" - at least not in my code.
If the application is not based on Swing, and you want different threads to perform tasks in parallel and sometimes send messages to each other, consider ZeroMQ "A socket library that acts like a Concurrency framework." In ZeroMQ, each thread starts an event loop that reads and processes messages. A thread can schedule work on its own thread by sending itself a message. It can schedule work / notify another thread by sending a message to this thread (socket).
Anyway, good luck.