use synchronized to sync 2 threads