title: Alternative for endless loop as listener
body: <p>Ok, maybe this is kind of a noob question on my part. But I want to ask about this. I have a Java web application that checks a DataQueue from a AS400 with an endless loop. If there's a message in the queue, it transfers it to an MQ, if not, just keeps checking. </p>
  
  <p>At first this was a good idea, but seems that when I deploy this web app (ServletContextListener) in WAS and start it, I just can't stop it. Maybe because it's consumming the resources. </p>
  
  <p>So maybe an endless loop isn't the answer. Do you know a way to constantly check for new messages on an AS400 DataQueue?</p>