Data persistence in multithreading envirement