Here's an idea. How about locking the whole map and wait on the map itself (timed wait)? Once a thread adds a task to the map it should `notify` this map. Then you can check on the size of the map and determine when to make progress.
Given that, you might want to use `Collection.synchronizedMap` even it doesn't expose it's internal `mutex` so you can use it. Still, it's clear you are not depending on the lock free concurrent map version but you lock the whole map. No big deal for this use case. It's not critical contention wise. [ Full content available at: https://github.com/apache/kafka/pull/5516 ] This message was relayed via gitbox.apache.org for [email protected]
