Your polling method bypasses the interval, making it poll the queue at 100% CPU. I'm amazed to see something like this here, surely this has been noticed before?
For an easy fix you move the Thread.sleep() out the conditional block, though it'd be better if you forfeit polling and use proper synchronisation.
Your polling method bypasses the interval, making it poll the queue at 100% CPU. I'm amazed to see something like this here, surely this has been noticed before?
For an easy fix you move the
Thread.sleep()
out the conditional block, though it'd be better if you forfeit polling and use proper synchronisation.