The problem with this approach is that it drains the queue while checking it and putting values back which creates a window where there would be a non-expired worker but can't be seen and a new worker is created. You could use a queue.iterator() and remove() expired items; but I'd check the contract on the CLQ first to be sure.