Balaji Soundarajan wrote:
Here i don't want to make the thread to wait status, it has to monitor the command from the client simultaneously for 120 seconds with out using CPU usage.
That's exactly what wait/notify is for. The command thread calls wait() on some object. Then when a message arrives from the client, the client thread calls notify() on that same object. The command thread gets the notification and wakes up, processes the command, and calls wait() again to wait for another command.