Preventing buffer overflow

Log rotation can cause buffer overflow (and probably underflow too) if there is concurrent access to the byte buffer underneath a persistence window being flushed.
This prevents interference from reads by duplicating the state flags on the byte buffer such that flushing can happens even while the window is being read.
Also, it prevents there are no writes in flight by ensuring all code paths leading to a log rotation go through XaResourceManager and thus it's locking behaviour