結果 : how to make a block of code thread safe in java