changed boolean read to not use a synchronized method but a volatile variable