Github user bgutjahr commented on the issue: https://github.com/apache/activemq-artemis/pull/1144 I replaced my code with a new implemented. I could not get rid of using synchronization, since the timeout-handle block in poll has to be synchronized with offer. But I made a couple of improvements: 1. I used a private lock object to synchronize on 2. I added comments to explain how the code works 3. I fixed a race condition that had been caused by using queue.size(), which changed within super.poll/take calls by now thread-safely maintaining the delta beween queue tasks and idle threads.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---