testing multithreading in java