Using non-final variables to lock can cause thread-safety problems.According to my understanding, it is appropriate to add the final keyword here