Use synchronized statements to resolve ConcurrentModification issue in PrintSpooler