This is a sample source code using condition variable in java to manage a queue of messages using by multithread