try {
maxNumberInvariant.readLock().lock();
Object result;
try {
// first try to take an element without waiting
result = queue.poll();
if (result == null) {
// there are no elements in the queue, make sure the producer is started
keyProducerStartLatch.open();
// our address might have been removed from the consistent hash
if (!address.equals(getAddressForKey(address)))