This code is actually very strange. I do not understand the synchronized block around an AtomicBoolean.
I'll need some time and investigation to check why this code exists.