The issue seems to be with the poll() and take() methods. The Queue.take() is a blocking call and it waits but the other one was throwing a null pointer exception because of which I see that the thread is not in RUNNABLE state and becomes TERMINATED. To fix that I added some extra logic which got me into trouble. Thanks to everyone who took a look at this.