fixed the known bug, used AtomicBoolean for shutdown comparisons and integrated it in the listener.