Trong ví dụ về threadpool của and Dũng, em thấy anh áp dụng synchronize cho cả method và block trong method, làm như thế thì có được gì hơn lợi hơn so với chỉ synchronize cho method 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.
1. Em đang nói đến ví dụ này nhỉ?
2. Trên thực tế thì việc synchronized method nó cũng tương với synchronized(this) nên trong ví dụ ở trên thì
synchronized (queue)
là thừa em ạ.