Em thấy có warnings ở chỗ synchronized (gameService)
và synchronized (room)
. Anh giải thích giúp em vì sao có warnings này được không ạ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Warning này là do cái gameService và room có thể null em ạ, tuy nhiên thực tế thì không bao giờ em ạ
Em đọc thấy bảo không nên dùng
synchronized
với non-final field. Mà cáigameService
của mình là non-final, anh giải thích chỗ này được không ạ?https://stackoverflow.com/questions/6910807/synchronization-of-non-final-field/21462631