When threads need to work together in a producer-consumer relationship (often called publish-subscribe) , things can go awry due to the unpredictable nature of threads. Data may get lost and some threads may get locked out, waiting forever for an event that has already occurred. Java provides notify and wait - methods to coordinate access to shared memory. In this video we look at some of the unwanted things that can occur and how to write Java code to make things work smoothly.