switch to ConcurrentLinkedQueue for correctness, and use isEmpty() instead of .size() > 0 for performance